/* Edit 创作页：白底、墨绿与暖砂色，去掉紫色 AI 感 */
:root {
  --page: #ffffff;
  --paper: #fffdf8;
  --paper-strong: #ffffff;
  --ink: #16211f;
  --muted: #74807c;
  --line: #e9e2d6;
  --line-strong: #d9cbb8;
  --accent: #0f766e;
  --accent-dark: #0b4f4a;
  --accent-soft: #e4f3ef;
  --sand: #c0842f;
  --sand-soft: #f7eddc;
  --danger: #b42318;
  --danger-soft: #fff1ef;
  --shadow: 0 18px 45px rgba(35, 28, 18, 0.08);
  --shadow-soft: 0 8px 24px rgba(35, 28, 18, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  font-family: "Noto Serif SC", "Songti SC", "Microsoft YaHei", serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 18px 18px, rgba(15, 118, 110, 0.06) 1px, transparent 1.5px) 0 0 / 36px 36px,
    linear-gradient(180deg, var(--page) 0%, #fffaf1 100%);
  margin: 0;
}

button {
  background: var(--accent);
  color: #fff;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 10px 18px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.16);
  transition: transform 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(15, 118, 110, 0.22);
}

input {
  font-family: inherit;
}

/* 模态框 */
#modal,
#tagModal,
#coverModal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(22, 33, 31, 0.28);
  backdrop-filter: blur(8px);
  justify-content: center;
  align-items: center;
}

#modal {
  z-index: 1000;
}

#tagModal {
  z-index: 1100;
}

#coverModal {
  z-index: 9999;
}

#modal .modal-content,
#tagModal .modal-content,
#coverModal .modal-content {
  background: var(--paper-strong);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 24px;
  width: 340px;
  text-align: center;
  box-shadow: var(--shadow);
}

#tagModal .modal-content {
  width: 420px;
  max-height: 70vh;
  overflow-y: auto;
  text-align: left;
}

.modal-content h4 {
  margin: 0 0 16px;
  color: var(--ink);
  font-size: 18px;
  letter-spacing: 0.04em;
}

#modal input,
#coverModal input,
.tag-input-area input {
  width: 100%;
  padding: 10px 12px;
  margin-top: 10px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: #fffdf8;
  color: var(--ink);
  outline: none;
}

#modal input:focus,
#coverModal input:focus,
.tag-input-area input:focus,
#summaryInput:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

#cancelCreate,
#cancelCoverBtn,
#deleteDraftBtn,
#deleteBtn {
  background: var(--danger) !important;
  box-shadow: 0 8px 18px rgba(180, 35, 24, 0.14);
}

#closeTagModal {
  background: #59645f !important;
}

#coverDropArea {
  border-color: var(--line-strong) !important;
  background: linear-gradient(135deg, #fffdf8, #f8f2e8);
}

#dropText {
  color: var(--muted) !important;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 15px;
}

.tag {
  background: var(--sand-soft);
  border: 1px solid rgba(192, 132, 47, 0.24);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 14px;
  color: #6b4616;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tag:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(192, 132, 47, 0.14);
}

.tag button {
  margin-top: -2px;
  background: transparent !important;
  border: none;
  box-shadow: none;
  color: transparent;
  font-weight: bold;
  cursor: pointer;
  width: 20px;
  height: 26px;
  padding: 0;
}

.tag button:hover {
  color: var(--danger);
  transform: none;
}

.tag-input-area {
  display: flex;
  gap: 10px;
}

.tag-input-area button,
#addTags,
#setCoverimg {
  background: var(--sand) !important;
  box-shadow: 0 8px 18px rgba(192, 132, 47, 0.16);
}

@media (min-width: 769px) {
  .workspace {
    display: flex;
    flex-direction: row;
    min-height: 100vh;
    width: 100%;
  }

  .sidebar {
    position: fixed;
    left: 0;
    width: 17%;
    height: 100vh;
    background: rgba(255, 253, 248, 0.92);
    border-right: 1px solid var(--line);
    box-shadow: 12px 0 36px rgba(35, 28, 18, 0.05);
    padding: 18px 16px;
    overflow-y: auto;
    z-index: 100;
  }

  .tab-buttons {
    display: flex;
    justify-content: space-around;
    gap: 6px;
    margin-bottom: 12px;
    padding: 4px;
    background: #f6efe3;
    border: 1px solid var(--line);
    border-radius: 999px;
  }

  .tab-buttons button {
    flex: 1;
    margin: 0;
    padding: 8px 10px;
    background: transparent;
    color: var(--muted);
    border: none;
    box-shadow: none;
  }

  .tab-buttons button:hover {
    background: rgba(15, 118, 110, 0.08);
    color: var(--accent-dark);
    transform: none;
    box-shadow: none;
  }

  .tab-buttons button.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 8px 20px rgba(15, 118, 110, 0.18);
  }

  .article-list {
    margin-top: 12px;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
  }

  .article-item {
    padding: 11px 10px;
    margin-bottom: 6px;
    border: 1px solid transparent;
    border-radius: 14px;
    cursor: pointer;
    font-size: 15px;
    color: var(--ink);
    transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
  }

  .article-item:hover {
    background: var(--accent-soft);
    border-color: rgba(15, 118, 110, 0.18);
  }

  .article-item.active {
    background: #fffdf8;
    border-color: rgba(15, 118, 110, 0.32);
    border-left: 4px solid var(--accent);
    box-shadow: var(--shadow-soft);
  }

  #toolbar-container {
    position: fixed;
    top: 0;
    left: 325px;
    width: 1354px;
    height: 100px;
    background: rgba(255, 253, 248, 0.96);
    backdrop-filter: blur(14px);
    z-index: 999;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 10px 28px rgba(35, 28, 18, 0.06);
  }

  #editor-wrapper {
    display: none;
    position: relative;
    width: 78%;
    top: 110px;
    left: 325px;
    padding: 22px;
    background: var(--paper-strong);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
    height: auto;
  }

  #editor-container {
    min-height: 680px;
    padding: 24px;
    background: linear-gradient(180deg, #fff 0%, #fffdf8 100%);
    border: 1px solid var(--line);
    border-bottom: 3px solid var(--accent);
    border-radius: 18px;
  }

  .button_list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
  }

  #saveBtn {
    margin-right: 5px;
  }

  #functionDiv {
    display: none;
    margin-top: 12px;
  }

  #functionDiv button {
    margin: 5px;
    padding: 8px 14px;
    background: var(--accent);
  }

  #summary-container {
    min-height: 58px;
    background: #fffdf8;
    margin: 0 0 14px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--sand);
    border-radius: 16px;
  }

  #summary-container span {
    color: var(--sand);
    font-size: 13px;
    font-weight: 700;
  }

  #summaryInput {
    margin-top: 5px;
    width: 100%;
    font-size: 15px;
    border: none;
    outline: none;
    background: transparent;
    color: var(--ink);
  }

  #summaryInput::placeholder {
    color: #a49b8d;
  }

  #word-count-container {
    position: absolute;
    right: 30px;
    top: 28px;
    padding: 5px 12px;
    background: var(--accent-soft);
    border: 1px solid rgba(15, 118, 110, 0.16);
    border-radius: 999px;
    font-size: 13px;
    color: var(--accent-dark);
    z-index: 10;
  }

  #wordCount {
    font-weight: 700;
  }
}

@media (max-width: 768px) {
  .workspace {
    display: flex;
    flex-direction: column;
    background: #fffdf8;
  }

  .sidebar {
    width: 100%;
    background: var(--paper-strong);
    border-bottom: 1px solid var(--line);
    border-radius: 0 0 18px 18px;
    box-shadow: var(--shadow-soft);
  }

  #drag-bar {
    display: none;
  }

  .tab-buttons {
    margin: 14px 12px 8px;
    display: flex;
    gap: 6px;
    padding: 4px;
    background: #f6efe3;
    border: 1px solid var(--line);
    border-radius: 999px;
  }

  .tab-buttons button {
    flex: 1;
    padding: 7px 4px;
    margin: 0;
    background: transparent;
    color: var(--muted);
    border: none;
    border-radius: 999px;
    box-shadow: none;
  }

  .tab-buttons button.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 8px 18px rgba(15, 118, 110, 0.18);
  }

  #editor-wrapper {
    width: 100%;
    background: var(--paper-strong);
    border-radius: 18px 18px 0 0;
    box-shadow: var(--shadow-soft);
  }

  #editor-container {
    min-height: 380px;
    padding: 14px;
    border-top: 1px solid var(--line);
  }

  .button_list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin: 14px 10px 20px;
  }

  .button_list button {
    flex: 1 1 40%;
    margin: 0 !important;
    padding: 8px 10px;
    font-size: 13px;
  }

  #functionDiv {
    display: none;
    margin: 10px 12px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
  }

  #functionDiv button {
    margin: 5px;
    width: 88px;
    height: 32px;
    padding: 0;
  }

  #article-list {
    min-height: 50px;
    margin: 0 12px 10px;
    border-bottom: 1px solid var(--line);
  }

  .article-item {
    padding: 9px 8px;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
    font-size: 14px;
    border-radius: 12px;
  }

  .article-item:hover {
    background: var(--accent-soft);
  }

  .article-item.active {
    background: #fffdf8;
    border-left: 4px solid var(--accent);
    box-shadow: var(--shadow-soft);
  }

  #addNewArticle {
    background: var(--accent) !important;
    width: 82px !important;
    font-size: 12px !important;
  }

  #summary-container {
    margin: 12px 15px;
    background: #fffdf8;
    border: 1px solid var(--line);
    border-left: 4px solid var(--sand);
    border-radius: 14px;
    padding: 8px 12px;
  }

  #summaryInput {
    width: 100%;
    font-size: 15px;
    border: none;
    outline: none;
    background: transparent;
    color: var(--ink);
  }

  #summaryInput::placeholder,
  #summary-container span {
    color: #a49b8d;
  }
}

/* wangEditor 轻量覆盖 */
.w-e-bar:not(.w-e-hover-bar),
.w-e-toolbar {
  background: transparent !important;
}

.w-e-hover-bar {
  background: #fff !important;
}

.w-e-bar-item button {
  box-shadow: none;
  color: var(--ink) !important;
}

.w-e-bar-item button:hover {
  background: var(--accent-soft) !important;
  transform: none;
}
