/* Memory editor prototype — intentionally independent from product architecture. */
body.editor-open { overflow: hidden; }

.story-editor-entry {
  margin: 18px 0 10px;
  padding: 16px;
  border: 1px solid var(--line, #ddd5c7);
  border-radius: 20px;
  background: var(--paper-strong, #fffdf7);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.story-editor-entry p { margin: 3px 0 0; color: var(--muted, #6f695f); font-size: 14px; line-height: 1.4; }
.story-editor-entry strong { display: block; font-family: var(--font-serif, serif); font-size: 19px; }
.story-editor-entry button,
.editor-primary,
.editor-secondary,
.editor-quiet {
  min-height: 44px;
  border: 0;
  border-radius: 14px;
  font: inherit;
  font-weight: 760;
  cursor: pointer;
}
.story-editor-entry button,
.editor-primary { background: var(--accent, #536846); color: #fff; padding: 0 16px; }
.editor-secondary { background: var(--accent-soft, #e7eadf); color: var(--accent-deep, #35432f); padding: 0 16px; }
.editor-quiet { background: transparent; color: var(--text, #28251f); padding: 0 10px; }

.editor-layer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--paper, #f7f3e9);
  color: var(--text, #28251f);
  overflow: hidden;
}
.editor-shell { height: 100%; display: flex; flex-direction: column; }
.editor-topbar {
  flex: 0 0 auto;
  min-height: 58px;
  padding: max(8px, env(safe-area-inset-top)) 12px 8px;
  border-bottom: 1px solid var(--line, #ddd5c7);
  background: color-mix(in srgb, var(--paper, #f7f3e9) 94%, transparent);
  display: grid;
  grid-template-columns: minmax(72px, auto) 1fr minmax(72px, auto);
  align-items: center;
  gap: 8px;
}
.editor-topbar .editor-status { text-align: center; color: var(--muted, #6f695f); font-size: 13px; font-weight: 700; }
.editor-topbar .editor-right { justify-self: end; }
.editor-main { flex: 1 1 auto; overflow: auto; -webkit-overflow-scrolling: touch; }
.editor-canvas { width: min(720px, 100%); margin: 0 auto; padding: 34px 20px 140px; }
.editor-kicker { margin: 0 0 10px; color: var(--accent-deep, #35432f); font-size: 12px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.editor-title {
  width: 100%;
  min-height: 52px;
  padding: 0;
  border: 0;
  outline: 0;
  resize: none;
  overflow: hidden;
  background: transparent;
  color: var(--text, #28251f);
  font-family: var(--font-serif, serif);
  font-size: clamp(32px, 8vw, 48px);
  font-weight: 650;
  line-height: 1.06;
}
.editor-title::placeholder { color: color-mix(in srgb, var(--muted, #6f695f) 52%, transparent); }
.editor-hint { margin: 10px 0 28px; color: var(--muted, #6f695f); font-size: 14px; }
.editor-blocks { display: grid; gap: 18px; }
.editor-block { position: relative; }
.editor-writing {
  min-height: 62px;
  outline: 0;
  font-size: 18px;
  line-height: 1.72;
  white-space: pre-wrap;
}
.editor-writing:empty::before { content: attr(data-placeholder); color: color-mix(in srgb, var(--muted, #6f695f) 55%, transparent); }
.editor-writing h3 { margin: 0; font-family: var(--font-serif, serif); font-size: 25px; line-height: 1.25; }
.editor-quote .editor-writing {
  padding: 4px 0 4px 18px;
  border-left: 3px solid var(--accent, #536846);
  font-family: var(--font-serif, serif);
  font-size: 23px;
  line-height: 1.5;
}
.editor-mini-toolbar {
  display: flex;
  gap: 4px;
  margin-top: 7px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .14s ease;
}
.editor-block:focus-within .editor-mini-toolbar { opacity: 1; pointer-events: auto; }
.editor-mini-toolbar button {
  min-width: 38px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: var(--paper-strong, #fffdf7);
  color: var(--text, #28251f);
  font: inherit;
  font-weight: 800;
}
.editor-remove {
  position: absolute;
  right: 8px;
  top: 8px;
  z-index: 2;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: color-mix(in srgb, #000 55%, transparent);
  color: #fff;
  font-size: 20px;
}
.editor-media {
  border: 1px solid var(--line, #ddd5c7);
  border-radius: 18px;
  overflow: hidden;
  background: var(--paper-strong, #fffdf7);
}
.editor-media-placeholder {
  min-height: 190px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 9px;
  padding: 28px;
  text-align: center;
  background: var(--accent-soft, #e7eadf);
  color: var(--accent-deep, #35432f);
}
.editor-media-placeholder .media-icon { font-size: 32px; }
.editor-file-button { display: inline-grid; place-items: center; min-height: 44px; padding: 0 15px; border-radius: 13px; background: var(--accent, #536846); color: #fff; font-weight: 760; cursor: pointer; }
.editor-file-button input { position: absolute; opacity: 0; pointer-events: none; }
.editor-media img, .editor-media video { display: block; width: 100%; max-height: 520px; object-fit: cover; background: #000; }
.editor-caption, .editor-video-url {
  width: 100%;
  min-height: 45px;
  box-sizing: border-box;
  border: 0;
  border-top: 1px solid var(--line, #ddd5c7);
  outline: 0;
  padding: 11px 14px;
  background: transparent;
  color: var(--text, #28251f);
  font: inherit;
}
.editor-gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 3px; background: var(--line, #ddd5c7); }
.editor-gallery img { aspect-ratio: 1; object-fit: cover; min-width: 0; }
.editor-video-actions { padding: 14px; display: grid; gap: 10px; }
.editor-video-actions label { width: fit-content; }

.editor-add-wrap { position: relative; margin: 28px 0 0; display: flex; justify-content: center; }
.editor-add {
  width: 48px;
  height: 48px;
  border: 1px solid var(--line, #ddd5c7);
  border-radius: 50%;
  background: var(--paper-strong, #fffdf7);
  color: var(--accent-deep, #35432f);
  font-size: 28px;
  line-height: 1;
}
.editor-add-menu {
  position: absolute;
  bottom: 58px;
  left: 50%;
  transform: translateX(-50%);
  width: min(330px, calc(100vw - 32px));
  padding: 9px;
  border: 1px solid var(--line, #ddd5c7);
  border-radius: 18px;
  background: var(--paper-strong, #fffdf7);
  box-shadow: 0 18px 55px rgba(32, 28, 23, .17);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.editor-add-menu button { min-height: 52px; border: 0; border-radius: 13px; background: transparent; color: var(--text, #28251f); text-align: left; padding: 9px 11px; font: inherit; font-weight: 730; }
.editor-add-menu button:hover { background: var(--accent-soft, #e7eadf); }
.editor-add-menu button:last-child { grid-column: 1 / -1; }

.editor-bottom {
  position: fixed;
  z-index: 1001;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 16px max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line, #ddd5c7);
  background: color-mix(in srgb, var(--paper, #f7f3e9) 96%, transparent);
}
.editor-bottom-inner { width: min(720px, 100%); margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.editor-preview { width: min(720px, 100%); margin: 0 auto; padding: 40px 20px 100px; }
.editor-preview .preview-meta { color: var(--accent-deep, #35432f); font-size: 12px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.editor-preview h1 { margin: 10px 0 26px; font-family: var(--font-serif, serif); font-size: clamp(34px, 9vw, 52px); line-height: 1.05; }
.editor-preview p { font-size: 18px; line-height: 1.72; }
.editor-preview blockquote { margin: 28px 0; padding-left: 18px; border-left: 3px solid var(--accent, #536846); font-family: var(--font-serif, serif); font-size: 24px; line-height: 1.5; }
.editor-preview figure { margin: 28px 0; }
.editor-preview figcaption { margin-top: 8px; color: var(--muted, #6f695f); font-size: 14px; text-align: center; }
.editor-preview .editor-gallery { border-radius: 16px; overflow: hidden; }

.editor-meta-layer {
  position: absolute;
  inset: 0;
  z-index: 1004;
  display: flex;
  align-items: flex-end;
  background: rgba(22, 20, 17, .34);
}
.editor-meta-sheet {
  width: 100%;
  max-height: 88vh;
  overflow: auto;
  border-radius: 28px 28px 0 0;
  background: var(--paper-strong, #fffdf7);
  padding: 12px 20px max(22px, env(safe-area-inset-bottom));
}
.editor-meta-inner { width: min(620px, 100%); margin: 0 auto; }
.editor-grabber { width: 42px; height: 5px; border-radius: 999px; margin: 0 auto 18px; background: var(--line, #ddd5c7); }
.editor-meta-head { display: flex; justify-content: space-between; gap: 15px; align-items: flex-start; }
.editor-meta-head h2 { margin: 0; font-family: var(--font-serif, serif); font-size: 28px; }
.editor-meta-head p { margin: 5px 0 0; color: var(--muted, #6f695f); }
.editor-meta-close { width: 44px; height: 44px; flex: 0 0 auto; border: 0; border-radius: 50%; background: var(--accent-soft, #e7eadf); color: var(--text, #28251f); font-size: 22px; }
.editor-field { display: grid; gap: 7px; margin-top: 20px; }
.editor-field > span { font-weight: 780; }
.editor-field input, .editor-field select {
  width: 100%;
  min-height: 48px;
  box-sizing: border-box;
  border: 1px solid var(--line, #ddd5c7);
  border-radius: 13px;
  background: var(--paper, #f7f3e9);
  color: var(--text, #28251f);
  padding: 0 13px;
  font: inherit;
  font-size: 16px;
}
.editor-people { display: flex; flex-wrap: wrap; gap: 8px; }
.editor-person-chip { min-height: 42px; border: 1px solid var(--line, #ddd5c7); border-radius: 999px; background: transparent; color: var(--text, #28251f); padding: 0 13px; font: inherit; }
.editor-person-chip.active { border-color: var(--accent, #536846); background: var(--accent-soft, #e7eadf); color: var(--accent-deep, #35432f); font-weight: 760; }
.editor-meta-actions { display: grid; grid-template-columns: 1fr 1.35fr; gap: 10px; margin-top: 26px; }
.editor-toast { position: fixed; z-index: 1010; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); transform: translateX(-50%); padding: 11px 15px; border-radius: 999px; background: #24221e; color: #fff; font-size: 14px; font-weight: 720; box-shadow: 0 10px 30px rgba(0,0,0,.22); }

@media (min-width: 760px) {
  .story-editor-entry { padding: 18px 20px; }
  .editor-canvas { padding-top: 52px; }
  .editor-meta-layer { align-items: center; justify-content: center; padding: 24px; }
  .editor-meta-sheet { max-width: 680px; border-radius: 28px; padding-bottom: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  .editor-mini-toolbar { transition: none; }
}
