/* ==========================================================================
   editor.css — 定制编辑器
   ========================================================================== */

body.editor-body {
  background: #f4f0e8;
}

/* ---------------- 顶栏 ---------------- */
.ed-top {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 64px;
  background: rgba(247, 243, 236, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.ed-top__inner {
  height: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding-inline: var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.ed-top__left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.ed-top__divider {
  width: 1px;
  height: 16px;
  background: var(--line);
}

.ed-top__title {
  font-size: 12.5px;
  letter-spacing: 0.12em;
  color: var(--ink-mute);
  white-space: nowrap;
}

.ed-top__right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.save-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--ink-mute);
}

.save-state i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ok);
  opacity: 0.75;
  transition: background 0.3s var(--ease);
}

.save-state.is-saving i {
  background: var(--accent);
  animation: save-pulse 1s ease-in-out infinite;
}

.save-state.is-error i {
  background: #b4553f;
}

.save-state.is-error {
  color: #a2453a;
}

@keyframes save-pulse {
  50% {
    opacity: 0.25;
  }
}

.ed-top__exit {
  font-size: 12.5px;
  color: var(--ink-soft);
  border-bottom: 1px solid transparent;
  white-space: nowrap;
}

.ed-top__exit:hover {
  border-bottom-color: currentColor;
}

/* ---------------- 布局 ---------------- */
.ed-layout {
  max-width: 1320px;
  margin: 0 auto;
  padding: 26px var(--gutter) 120px;
  display: grid;
  gap: 32px;
}

.ed-form {
  max-width: 700px;
  min-width: 0;
}

.ed-preview {
  display: none;
}

@media (min-width: 1024px) {
  .ed-layout {
    grid-template-columns: minmax(0, 1fr) 404px;
    gap: 52px;
    padding-bottom: 80px;
  }
  .ed-preview {
    display: block;
  }
}

/* ---------------- 面板 ---------------- */
.panel {
  margin-bottom: 30px;
}

.panel__head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
}

.panel__num {
  font-family: var(--font-serif);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  color: var(--accent);
  opacity: 0.8;
}

.panel__title {
  font-family: var(--font-serif);
  font-size: 1.06rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--ink);
}

.panel__hint {
  margin-left: auto;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-mute);
  white-space: nowrap;
}

.card {
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 20px;
}

.field-row {
  display: grid;
  gap: 16px;
}

@media (min-width: 560px) {
  .field-row {
    grid-template-columns: 1fr 1fr;
  }
}

.field + .field,
.field--gap {
  margin-top: 18px;
}

.field__label em.hint {
  font-style: normal;
}

.field-note {
  margin-top: 12px;
  font-size: 11.5px;
  line-height: 1.8;
  color: var(--ink-mute);
}

.field-note.is-warn {
  color: #a2453a;
}

.field-note--top {
  margin: 0 0 14px;
}

.textarea--tall {
  min-height: 210px;
}

/* ---------------- 动态列表（时间线 / 小事 / 约定） ---------------- */
.repeat__list {
  display: grid;
  gap: 10px;
}

.rep-row {
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  background: var(--paper-2);
  padding: 11px 12px;
}

.rep-row__top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rep-row__date {
  flex: none;
  width: 148px;
  padding: 8px 9px;
  font-size: 12px;
  min-height: 38px;
}

.rep-row__title {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  font-size: 13px;
  min-height: 38px;
}

.rep-row__del {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--ink-mute);
  font-size: 10px;
  display: grid;
  place-items: center;
  transition: color 0.25s var(--ease), border-color 0.25s var(--ease);
}

.rep-row__del:hover {
  color: #a2453a;
  border-color: currentColor;
}

.rep-row__text {
  margin-top: 8px;
  min-height: 58px;
  padding: 9px 10px;
  font-size: 13px;
  line-height: 1.75;
}

.rep-row--line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
}

.rep-row__idx {
  flex: none;
  width: 20px;
  font-family: var(--font-serif);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--accent);
  opacity: 0.75;
}

.rep-row--line .input {
  border-color: transparent;
  background: transparent;
  padding: 7px 4px;
  min-height: 34px;
  font-size: 13px;
}

.rep-row--line .input:hover {
  border-color: transparent;
  background: rgba(255, 253, 249, 0.9);
}

.rep-row--line .input:focus {
  border-color: var(--accent);
  background: #fff;
}

.repeat__add {
  width: 100%;
  margin-top: 11px;
  padding: 11px;
  border: 1px dashed rgba(22, 19, 15, 0.22);
  border-radius: var(--r-sm);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  background: transparent;
  transition: border-color 0.25s var(--ease), color 0.25s var(--ease),
    background 0.25s var(--ease);
}

.repeat__add:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(255, 253, 249, 0.7);
}

.repeat__add.is-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  border-color: var(--line-soft);
}

/* ---------------- 模板选择 ---------------- */
.tpl-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

/* 宽屏下一排四张，七套排成 4 + 3 */
@media (min-width: 720px) {
  .tpl-options {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.tpl-opt {
  position: relative;
  text-align: left;
  padding: 13px 12px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--raised);
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease),
    box-shadow 0.3s var(--ease), transform 0.3s var(--ease);
  overflow: hidden;
}

.tpl-opt:hover {
  border-color: rgba(22, 19, 15, 0.3);
  transform: translateY(-1px);
}

.tpl-opt.is-active {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
  background: #fffdf9;
}

.tpl-opt__letter {
  font-family: var(--font-serif);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--ink-mute);
  display: block;
}

.tpl-opt.is-active .tpl-opt__letter {
  color: var(--accent);
}

.tpl-opt__name {
  display: block;
  margin-top: 6px;
  font-family: var(--font-serif);
  font-size: 0.96rem;
  letter-spacing: 0.06em;
  color: var(--ink);
}

.tpl-opt__tag {
  display: block;
  margin-top: 3px;
  font-size: 10.5px;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
}

.tpl-opt__dots {
  display: flex;
  gap: 4px;
  margin-top: 9px;
}

.tpl-opt__dots span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1px solid rgba(22, 19, 15, 0.12);
}

.tpl-opt__check {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 9px;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}

.tpl-opt.is-active .tpl-opt__check {
  opacity: 1;
  transform: scale(1);
}

/* ---------------- 上传 ---------------- */
.upload {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 26px 18px 24px;
  border: 1px dashed rgba(22, 19, 15, 0.22);
  border-radius: var(--r-md);
  background: rgba(255, 253, 249, 0.55);
  cursor: pointer;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}

.upload:hover,
.upload:focus-visible {
  border-color: var(--accent);
  background: rgba(255, 253, 249, 0.9);
}

.upload.is-drag {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.upload__icon {
  width: 34px;
  height: 34px;
  color: var(--accent);
  opacity: 0.8;
}

.upload__icon svg {
  width: 100%;
  height: 100%;
}

.upload__title {
  margin-top: 10px;
  font-size: 13.5px;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.upload__sub {
  margin-top: 4px;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--ink-mute);
}

.upload__progress {
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--accent);
}

.thumbs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.thumbs:empty {
  display: none;
}

.thumb {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--raised);
  padding: 6px;
  cursor: grab;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease),
    box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
  -webkit-touch-callout: none;
}

.thumb:active {
  cursor: grabbing;
}

.thumb:hover {
  border-color: rgba(22, 19, 15, 0.24);
}

.thumb:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.thumbs.is-sorting .thumb {
  transition: none;
}

.thumb.is-dragging {
  opacity: 0.55;
  border-color: var(--accent);
  border-style: dashed;
  transform: scale(0.97);
}

body.is-sorting {
  user-select: none;
  -webkit-user-select: none;
  cursor: grabbing;
}

.thumbs-hint {
  margin-top: 10px;
  font-size: 11px;
  letter-spacing: 0.02em;
  line-height: 1.7;
  color: var(--ink-mute);
}

.thumbs-hint[hidden] {
  display: none;
}

.thumb__img {
  position: relative;
  overflow: hidden;
  border-radius: 2px;
  background: #ece5da;
}

.thumb__img img {
  -webkit-user-drag: none;
  user-select: none;
}

.thumb img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

.thumb__del {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(20, 17, 14, 0.62);
  color: #fff;
  font-size: 10px;
  display: grid;
  place-items: center;
  backdrop-filter: blur(4px);
  transition: background 0.25s var(--ease);
  z-index: 2;
}

.thumb__del:hover {
  background: #7a3a30;
}

.thumb__cap {
  margin-top: 6px;
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 2px;
  padding: 4px 5px;
  font-size: 11px;
  color: var(--ink-soft);
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease);
}

.thumb__cap::placeholder {
  color: #b8afa2;
}

.thumb__cap:hover {
  border-color: var(--line);
}

.thumb__cap:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
}

/* ---------------- 分段选择 ---------------- */
.seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--paper-2);
}

.seg__item {
  padding: 7px 15px;
  border-radius: var(--r-pill);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
}

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

.seg__item.is-active {
  background: var(--ink);
  color: #fbf8f3;
}

/* ---------------- 操作区 ---------------- */
.ed-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding-top: 6px;
}

.btn--text {
  --btn-bg: transparent;
  --btn-bd: transparent;
  --btn-fg: var(--ink-mute);
  padding: 10px 6px;
  color: var(--ink-mute);
  font-size: 12.5px;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: var(--line);
}

.btn--text:hover {
  --btn-fg: #a2453a;
  color: #a2453a;
  box-shadow: none;
  text-decoration-color: currentColor;
}

.ed-actions__note {
  width: 100%;
  font-size: 11px;
  color: var(--ink-mute);
  margin-top: 2px;
}

/* ---------------- 实时预览 ---------------- */
.ed-preview__inner {
  position: sticky;
  top: 92px;
}

.ed-preview__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-inline: 2px;
}

.ed-preview__label {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.ed-preview__sub {
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

.phone--live {
  --pw: 330px;
  --ps: 0.846;
  margin-inline: auto;
}

.phone--live .phone__screen,
.phone--overlay .phone__screen {
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  overscroll-behavior: contain;
}

.phone--live .phone__screen::-webkit-scrollbar,
.phone--overlay .phone__screen::-webkit-scrollbar {
  display: none;
}

.ed-preview__hint {
  margin-top: 14px;
  text-align: center;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
}

/* ---------------- 移动端底栏 ---------------- */
.mobile-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 55;
  display: flex;
  gap: 10px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: rgba(247, 243, 236, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}

.mobile-bar .btn {
  flex: 1;
}

@media (min-width: 1024px) {
  .mobile-bar {
    display: none;
  }
}

/* ---------------- 全屏预览 ---------------- */
.pv-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #12100d;
  display: flex;
  flex-direction: column;
  animation: pv-in 0.35s var(--ease) both;
}

.pv-overlay[hidden] {
  display: none;
}

@keyframes pv-in {
  from {
    opacity: 0;
  }
}

.pv-overlay__top {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  color: #f2ece1;
}

.pv-overlay__title {
  font-size: 12px;
  letter-spacing: 0.14em;
  color: rgba(242, 236, 225, 0.7);
  white-space: nowrap;
}

.pv-overlay__tabs {
  position: relative;
  display: flex;
  gap: 4px;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
}

.pv-overlay__tabs::-webkit-scrollbar {
  display: none;
}

.pv-overlay__tabs button {
  padding: 6px 12px;
  border-radius: var(--r-pill);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: rgba(242, 236, 225, 0.6);
  border: 1px solid transparent;
  white-space: nowrap;
}

.pv-overlay__tabs button.is-active {
  background: #f7f3ec;
  color: var(--ink);
}

.pv-overlay__close {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 12px;
  display: grid;
  place-items: center;
}

.pv-overlay__body {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 18px 12px calc(18px + env(safe-area-inset-bottom));
  overflow: hidden;
}

.phone--overlay {
  --pw: 340px;
  --ps: 0.872;
}

.phone--overlay .phone__frame {
  box-shadow: 0 40px 90px -40px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.12);
}

/* ---------------- 导出 / 导入 ---------------- */
.ed-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.ed-tools__sep {
  color: var(--ink-mute);
  opacity: 0.6;
}

.link-btn {
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: var(--line);
  padding: 2px 0;
}

.link-btn:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

.ed-tools__note {
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.85;
  color: var(--ink-mute);
  max-width: 52ch;
}

.ed-tools__note code {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 10.5px;
  background: rgba(22, 19, 15, 0.05);
  border-radius: 3px;
  padding: 1px 5px;
}

/* ---------------- 云端徽标 ---------------- */
.cloud-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  border: 1px solid rgba(142, 75, 65, 0.3);
  background: rgba(142, 75, 65, 0.06);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.cloud-badge[hidden] {
  display: none;
}

/* ---------------- 分享弹层 ---------------- */
.share {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(18, 16, 13, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: pv-in 0.3s var(--ease) both;
}

.share[hidden] {
  display: none;
}

.share__box {
  position: relative;
  width: min(460px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  background: var(--raised);
  border-radius: var(--r-lg);
  padding: 28px 24px 24px;
  box-shadow: var(--shadow-2);
  animation: share-in 0.4s var(--ease) both;
}

@keyframes share-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
}

.share__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--ink-mute);
  font-size: 10px;
  display: grid;
  place-items: center;
}

.share__title {
  margin-top: 12px;
  font-family: var(--font-serif);
  font-size: 1.36rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--ink);
}

.share__sub {
  margin-top: 8px;
  font-size: 12.5px;
  line-height: 1.85;
  color: var(--ink-mute);
}

.share__link {
  margin-top: 16px;
  padding: 11px 13px;
  border: 1px dashed rgba(22, 19, 15, 0.22);
  border-radius: var(--r-sm);
  background: var(--paper-2);
  word-break: break-all;
}

.share__link code {
  font-family: "SF Mono", Consolas, var(--font-sans);
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--ink-soft);
}

.share__card {
  display: block;
  width: 100%;
  margin-top: 14px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--paper-2);
}

.share__card[hidden] {
  display: none;
}

.share__actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.share__actions .btn {
  flex: 1;
  min-width: 120px;
}

.share__note {
  margin-top: 14px;
  font-size: 10.5px;
  line-height: 1.8;
  color: var(--ink-mute);
}

/* ---------------- 本机作品 ---------------- */
.works {
  margin-top: 38px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.works[hidden] {
  display: none;
}

.works__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.works__label {
  font-family: var(--font-serif);
  font-size: 0.98rem;
  letter-spacing: 0.08em;
  color: var(--ink);
}

.works__note {
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--ink-mute);
}

.works__list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12.5px;
}

.works__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}

.works__tpl {
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--ink-mute);
  flex: none;
}

.works__link {
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--line);
  padding-bottom: 1px;
  flex: none;
}

.works__link:hover {
  color: var(--accent);
  border-bottom-color: currentColor;
}

@media (max-width: 540px) {
  .pv-overlay__title {
    display: none;
  }
  .pv-overlay__tabs {
    margin-left: 0;
    flex: 1;
    justify-content: flex-start;
    padding-right: 4px;
  }
  .pv-overlay__tabs button {
    padding: 6px 10px;
    font-size: 11px;
  }
  .pv-overlay__top {
    padding-inline: 12px;
    gap: 8px;
  }
}

/* ---------------- 时刻照片 ---------------- */
.rep-row__media {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 9px;
}

.rep-media {
  position: relative;
  width: 66px;
  height: 48px;
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid var(--line);
  flex: none;
}

.rep-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rep-media__del {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(20, 17, 14, 0.65);
  color: #fff;
  font-size: 8px;
  display: grid;
  place-items: center;
}

.rep-media__add,
.rep-media__change {
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  border: 1px dashed rgba(22, 19, 15, 0.22);
  border-radius: var(--r-pill);
  padding: 6px 13px;
  transition: border-color 0.25s var(--ease), color 0.25s var(--ease);
}

.rep-media__add:hover,
.rep-media__change:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------------- 选图弹层 ---------------- */
.picker {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: grid;
  place-items: end center;
  background: rgba(18, 16, 13, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: pv-in 0.25s var(--ease) both;
}

.picker[hidden] {
  display: none;
}

.picker__box {
  width: min(660px, 100%);
  max-height: 78vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  background: var(--raised);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -20px 60px -30px rgba(22, 19, 15, 0.6);
  animation: picker-up 0.32s var(--ease) both;
}

@keyframes picker-up {
  from {
    transform: translateY(22px);
    opacity: 0;
  }
}

@media (min-width: 720px) {
  .picker {
    place-items: center;
  }
  .picker__box {
    width: min(700px, 92vw);
    max-height: 70vh;
    border-radius: 14px;
    padding-bottom: 18px;
  }
}

.picker__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.picker__title {
  font-family: var(--font-serif);
  font-size: 1.02rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.picker__sub {
  margin-top: 5px;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--ink-mute);
}

.picker__close {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--ink-mute);
  font-size: 10px;
  display: grid;
  place-items: center;
}

.picker__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  overflow-y: auto;
  padding-right: 2px;
  min-height: 80px;
}

@media (min-width: 520px) {
  .picker__grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.picker__item {
  aspect-ratio: 1;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--line);
  padding: 0;
  background: #ece5da;
}

.picker__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--ease);
}

.picker__item:hover img {
  transform: scale(1.06);
}

.picker__upload {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px dashed rgba(22, 19, 15, 0.25);
  border-radius: 4px;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--ink-mute);
  background: var(--paper-2);
}

.picker__upload:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.picker__plus {
  font-size: 17px;
  line-height: 1;
}

/* ---------------- 确认弹层 ---------------- */
.confirm {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(18, 16, 13, 0.5);
  backdrop-filter: blur(4px);
  animation: pv-in 0.25s var(--ease) both;
}

.confirm[hidden] {
  display: none;
}

.confirm__box {
  width: min(380px, 100%);
  background: var(--raised);
  border-radius: var(--r-lg);
  padding: 26px 24px 22px;
  box-shadow: var(--shadow-2);
}

.confirm__title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.confirm__text {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.9;
  color: var(--ink-mute);
}

.confirm__actions {
  margin-top: 22px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ---------------- 小屏微调 ---------------- */
@media (max-width: 560px) {
  .ed-top__title,
  .ed-top__divider,
  .save-state span {
    display: none;
  }
  .ed-top__inner {
    height: 60px;
  }
  .ed-layout {
    padding-top: 20px;
  }
  .card {
    padding: 16px;
  }
  .tpl-opt {
    padding: 11px 10px;
  }
  .tpl-opt__tag {
    font-size: 10px;
  }
  .thumbs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .btn {
    padding: 13px 22px;
  }
  /* 手机上日期单独一行，标题与删除按钮并排 */
  .rep-row__top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }
  .rep-row__date {
    grid-column: 1 / -1;
    width: 100%;
  }
  .rep-row__title {
    grid-column: 1;
  }
  .rep-row__del {
    grid-column: 2;
    justify-self: end;
  }
}

/* ============================ 素材库：编辑器推荐条 ============================ */
.lib-strip {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  display: grid;
  gap: 10px;
}

.lib-strip__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.lib-strip__title {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
}

.lib-strip__title span {
  opacity: 0.55;
}

.lib-strip__more {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}

.lib-strip__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.lib-tile {
  position: relative;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.04);
  cursor: pointer;
  text-align: left;
}

.lib-tile img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.lib-tile span {
  display: block;
  padding: 4px 6px 5px;
  font-size: 9.5px;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lib-tile.is-on {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.06);
}

.lib-strip__note {
  margin: 0;
  font-size: 11px;
  line-height: 1.8;
  color: var(--ink-mute);
}

.lib-tile__dot {
  position: absolute;
  left: 5px;
  top: 5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.lib-tile__score {
  position: absolute;
  right: 5px;
  top: 4px;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 8px;
  font-style: normal;
  letter-spacing: 0.04em;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
}

.share__warn {
  margin: 8px 0 14px;
  padding: 9px 11px;
  border-radius: 8px;
  background: rgba(180, 68, 58, 0.07);
  border: 1px solid rgba(180, 68, 58, 0.18);
  font-size: 11.5px;
  line-height: 1.7;
  color: #7d3b34;
}

.share__warn b {
  font-weight: 600;
}

/* ============================ 设备未开通提示 ============================ */
.gate {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(22, 19, 15, 0.5);
  backdrop-filter: blur(3px);
}

.gate__box {
  width: min(380px, 100%);
  padding: 22px 20px 18px;
  border-radius: 14px;
  background: #fbf8f3;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.6);
  display: grid;
  gap: 10px;
}

.gate__k {
  margin: 0;
  font-size: 9px;
  letter-spacing: 0.3em;
  color: #8a7f70;
}

.gate__t {
  margin: 0;
  font-size: 17px;
  letter-spacing: 0.04em;
}

.gate__p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.9;
  color: #4a423a;
}

.gate__acts {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.gate__hint {
  margin: 0;
  font-size: 10.5px;
  color: #8a7f70;
}

/* ============================ 长按删除 ============================ */
[data-lp] {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

[data-lp].is-lp {
  transform: scale(0.985);
  filter: brightness(0.97);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.lp-sheet {
  position: fixed;
  z-index: 400;
  width: 176px;
  padding: 6px;
  border-radius: 12px;
  background: #fffdf9;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(22, 19, 15, 0.06);
  animation: lp-in 0.14s ease-out;
}

@keyframes lp-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.97);
  }
}

.lp-sheet__item {
  display: block;
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-radius: 8px;
  background: none;
  text-align: left;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: #16130f;
  cursor: pointer;
}

.lp-sheet__item:active {
  background: rgba(22, 19, 15, 0.05);
}

.lp-sheet__item--danger {
  color: #b4423a;
}

.lp-confirm {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(22, 19, 15, 0.42);
}

.lp-confirm__box {
  width: min(320px, 100%);
  padding: 20px 18px 16px;
  border-radius: 14px;
  background: #fbf8f3;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.6);
}

.lp-confirm__t {
  margin: 0 0 6px;
  font-size: 15px;
  letter-spacing: 0.02em;
}

.lp-confirm__s {
  margin: 0 0 16px;
  font-size: 11.5px;
  color: #8a7f70;
}

.lp-confirm__acts {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn.lp-danger {
  --btn-bg: #b4423a;
  --btn-bd: #b4423a;
  --btn-fg: #fff;
}

/* 换手机：转移码 */
.share__transfer {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  text-align: center;
}

.share__transfer-btn {
  border: 0;
  background: none;
  padding: 4px 6px;
  font-size: 12px;
  color: var(--ink-mute);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.share__transfer-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.share__transfer-out {
  margin: 8px 0 0;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--ink);
}

.share__transfer-out[hidden] {
  display: none !important;
}

/* 素材库：客户自己上传 */
.lib-tile--upload {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  aspect-ratio: 3 / 4;
  border: 1px dashed var(--line-strong, rgba(0,0,0,.18));
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink-mute);
  font-size: 12px;
  cursor: pointer;
}

.lib-tile--upload:hover {
  border-color: var(--ink-mute);
  color: var(--ink);
}

.lib-tile__plus {
  font-size: 18px;
  line-height: 1;
  color: var(--ink-mute);
}

/* 款式选择：放在最上面 */
.panel--mode {
  border: 1px solid var(--line);
  border-radius: var(--r-lg, 20px);
  padding: 22px 22px 20px;
  background: linear-gradient(180deg, rgba(255,255,255,.75), rgba(255,255,255,.45));
}

.seg--lg {
  display: flex;
  width: 100%;
  margin-top: 14px;
}

.seg--lg .seg__btn {
  flex: 1 1 0;
  padding: 12px 10px;
  font-size: 14px;
}

.mode-desc {
  margin: 14px 0 0;
  font-size: 12.5px;
  line-height: 1.9;
  color: var(--ink-mute);
}

/* 背景音乐：自上传 */
.seg--music {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.music-custom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.music-custom .ghost-btn {
  font-size: 12.5px;
}

.music-custom__now {
  font-size: 12.5px;
  color: var(--ok, #3f7a52);
}

.music-custom__now[hidden],
.music-custom__del[hidden] {
  display: none !important;
}

.music-custom__del {
  border: 0;
  background: none;
  padding: 0;
  font-size: 12px;
  color: var(--ink-mute);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
