/* ── 日记步骤容器卡片（玻璃效果） ────────────────────────────── */
#diary-steps {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 18px;
  padding: 24px 24px 28px;
  box-shadow:
    0 8px 32px rgba(30,15,5,0.18),
    0 1px 4px  rgba(30,15,5,0.10);
}

/* 内容层高于背景层 */
#diary-steps > *:not(#diary-bg) {
  position: relative;
  z-index: 2;
}

/* 历史编辑：portal 容器（全屏遮罩 + 居中卡片） */
#diary-edit-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, .4);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh 20px 60px;
  overflow-y: auto;
}

#diary-edit-overlay #diary-steps {
  position: relative;
  flex-shrink: 0;
  width: min(560px, 92vw);
  max-height: none;
  overflow: visible;
}

/* ── 日记步骤通用 ─────────────────────────────────────────────── */
.step-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  width: 100%;
}

.step-tabs {
  display: flex;
  gap: 6px;
}

.step-tab {
  padding: 5px 14px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}

.step-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.step-tab.done:not(.active) {
  color: var(--accent);
  border-color: var(--accent);
}

.step-save-btn {
  margin-left: auto;
  font-size: 13px;
  padding: 5px 14px;
}

.step-question {
  font-size: 24px;
  font-weight: 400;
  margin-bottom: 36px;
  line-height: 1.5;
}

.step-question small {
  font-size: 13px;
  color: var(--muted);
  font-weight: 300;
  margin-left: 8px;
}

.step-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

/* ── Step 1：打分 ─────────────────────────────────────────────── */
.mood-row {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.mood-btn {
  flex: 1;
  padding: 12px 4px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  font-size: 15px;
  font-family: var(--font);
  color: var(--muted);
  transition: border-color .15s, background .15s, color .15s, transform .1s;
}
.mood-btn[data-mood="1"]  { --c: #9e9e9e; }
.mood-btn[data-mood="2"]  { --c: #8f8f8f; }
.mood-btn[data-mood="3"]  { --c: #c0794a; }
.mood-btn[data-mood="4"]  { --c: #c97c35; }
.mood-btn[data-mood="5"]  { --c: #b89a20; }
.mood-btn[data-mood="6"]  { --c: #8aaa30; }
.mood-btn[data-mood="7"]  { --c: #4aaa5a; }
.mood-btn[data-mood="8"]  { --c: #2ea87a; }
.mood-btn[data-mood="9"]  { --c: #2090c0; }
.mood-btn[data-mood="10"] { --c: #5060d8; }
.mood-btn:hover    { border-color: var(--c, var(--accent)); color: var(--c, var(--accent)); background: color-mix(in srgb, var(--c, var(--accent)) 12%, transparent); }
.mood-btn.selected { border-color: var(--c, var(--accent)); background: var(--c, var(--accent)); color: #fff; transform: scale(1.08); }

.score-hint {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  padding: 0 2px;
}

/* ── Step 2：活动 ─────────────────────────────────────────────── */

/* 天空弧线组件 */
.sky-arc-svg {
  display: block;
  width: 100%;
  max-width: 340px;
  height: auto;
  margin: 4px auto 0;
  overflow: visible;
}
.sky-arc-orb {
  transition: transform .6s cubic-bezier(.4, 0, .2, 1);
}
.sky-arc-sun,
.sky-arc-moon {
  transition: opacity .35s ease;
}

/* 时间段 Tab */
.activity-periods {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.period-tab {
  flex: 1;
  padding: 7px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font);
  font-size: 14px;
  cursor: pointer;
  transition: all .15s;
}
.period-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 500;
}
.period-count {
  display: inline-block;
  background: rgba(255,255,255,0.35);
  color: inherit;
  font-size: 11px;
  padding: 0 5px;
  border-radius: 8px;
  margin-left: 3px;
  line-height: 1.6;
}
.period-tab:not(.active) .period-count {
  background: var(--accent-bg);
  color: var(--accent);
}

/* 活动分类 Tab */
.activity-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}
.act-tab-btn {
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  transition: background .2s, border-color .2s, color .2s;
}
.act-tab-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* 当前时间段内该类别有选中项时的状态 */
.act-tab-btn.has-selection {
  border-width: 2px;
  border-color: var(--accent);
  color: var(--accent);
  background: #f0b07a;
  font-weight: 500;
}
.act-tab-btn.active.has-selection {
  border-width: 1px;
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 500;
}

/* 活动搜索框 */
.activity-search-wrap {
  margin-bottom: 10px;
}
.activity-search-wrap input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color .2s;
}
.activity-search-wrap input:focus {
  border-color: var(--period-border, var(--accent));
}
.activity-search-wrap input::placeholder {
  color: var(--muted);
}
.act-search-empty {
  font-size: 13px;
  color: var(--muted);
  padding: 8px 2px;
}

/* 活动标签网格 */
.activity-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  min-height: 80px;
  margin-bottom: 10px;
}
.act-tag {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  transition: background .2s, border-color .2s, color .2s;
}
.act-tag:hover    { border-color: var(--accent); color: var(--accent); }
.act-tag.selected { background: var(--accent); color: #fff; border-color: var(--accent); }

/* 自定义 tag：删除按钮 */
.act-tag.custom   { padding-right: 8px; }
.act-tag-del {
  display: inline-block;
  margin-left: 5px;
  font-size: 13px;
  opacity: 0.45;
  line-height: 1;
  transition: opacity .15s;
}
.act-tag:hover .act-tag-del,
.act-tag.selected .act-tag-del { opacity: 0.8; }

/* 新建 tag 按钮 */
.act-tag-add {
  border-style: dashed;
  color: var(--muted);
}
.act-tag-add:hover { border-color: var(--accent); color: var(--accent); }

/* 新建 tag 内联输入 */
.act-tag-input-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 10px;
  border: 1px dashed var(--accent);
  border-radius: 20px;
  background: var(--surface);
}
.act-tag-input {
  padding: 6px 0;
  border: 0;
  background: transparent;
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  outline: none;
  width: 96px;
  min-width: 0;
}
.act-tag-input-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  font-size: 14px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.act-tag-input-btn:hover {
  background: rgba(0, 0, 0, 0.06);
}
.act-tag-input-btn.confirm {
  color: var(--accent);
}
.act-tag-input-btn.cancel {
  color: #b36a5d;
}
.act-tag-delete-toggle {
  border-style: dashed;
  color: var(--muted);
  background: var(--surface);
}
.act-tag-delete-toggle.active {
  border-style: solid;
  border-color: #c45c4f;
  background: #c45c4f;
  color: #fff;
  box-shadow: 0 4px 12px rgba(196, 92, 79, 0.18);
}
.act-tag-delete-toggle.active:hover {
  border-color: #b34c40;
  background: #b34c40;
  color: #fff;
}
.act-tag.delete-mode {
  border-style: dashed;
}
.act-tag.delete-selected,
.act-tag.selected.delete-selected {
  border-color: #c45c4f;
  background: #fff1ef;
  color: #c45c4f;
}
.act-tag.delete-selected .act-tag-del,
.act-tag.selected.delete-selected .act-tag-del {
  opacity: 0.8;
}

/* 时间段随手记 */
.period-note-input {
  width: 100%;
  margin-bottom: 14px;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  resize: none;
  line-height: 1.7;
  transition: border-color .2s;
}
.period-note-input:focus { border-color: var(--period-border, var(--accent)); outline: none; }
.period-note-input::placeholder { color: var(--muted); }

.done-period-note {
  width: 100%;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  margin-top: 5px;
  line-height: 1.6;
}

#activity-count { font-size: 12px; color: var(--muted); }

/* ── Step 3：引导问答 ─────────────────────────────────────────── */
.qa-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.qa-option {
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: var(--font);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.qa-option:hover    { border-color: var(--accent); background: var(--accent-bg); }
.qa-option.selected { border-color: var(--accent); background: var(--accent-bg); }
.qa-custom textarea { resize: vertical; min-height: 70px; }

/* ── Step 4：感受 ─────────────────────────────────────────────── */
.closing-note-input {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  min-height: 90px;
}

.feeling-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.feeling-btn {
  padding: 9px 18px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  font-family: var(--font);
  font-size: 14px;
  cursor: pointer;
  transition: all .2s;
}
.feeling-btn:hover    { border-color: var(--accent); background: var(--accent-bg); }
.feeling-btn.selected { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── 隐私控制（行内开关） ─────────────────────────────────────── */
.privacy-inline {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
}

/* toggle switch */
.privacy-inline input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 30px;
  height: 17px;
  border-radius: 9px;
  background: var(--border);
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .2s;
}

.privacy-inline input[type="checkbox"]::after {
  content: '';
  position: absolute;
  left: 2px;
  top: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
}

.privacy-inline input[type="checkbox"]:checked {
  background: var(--accent);
}

.privacy-inline input[type="checkbox"]:checked::after {
  transform: translateX(13px);
}

@media (max-width: 680px), (pointer: coarse) {
  .act-tag.custom {
    padding-right: 14px;
  }

  .act-tag-del {
    display: none;
  }

  .act-tag-input-wrap {
    width: 100%;
    justify-content: space-between;
    border-radius: 16px;
  }

  .act-tag-input {
    flex: 1;
    width: auto;
  }

  .act-tag-input-btn {
    width: 28px;
    height: 28px;
    font-size: 15px;
  }
}
