/* ═══════════════════════════════════════════════
   PERSON PAGE STYLES
   ═══════════════════════════════════════════════ */

.person-page {
  position: relative;
  z-index: 2;
  padding: calc(var(--nav-h) + 50px) 32px 80px;
  max-width: 1000px;
  margin: 0 auto;
}

/* ── BACK LINK ── */
.person-back {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-body);
  font-size: 14px;
  font-style: italic;
  color: var(--cream-dim);
  text-decoration: none;
  margin-bottom: 40px;
  transition: color var(--transition), gap var(--transition);
}
.person-back::before { content: '←'; font-size: 18px; }
.person-back:hover { color: var(--gold-light); gap: 14px; }

/* ── HEADER ── */
.person-header {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 50px;
  align-items: start;
  margin-bottom: 70px;
}

@media (max-width: 720px) {
  .person-header {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .person-header__photo { margin: 0 auto; }
}

.person-header__photo {
  width: 260px;
  aspect-ratio: 4/5;
  background: #f5f0e8;
  border-radius: 6px;
  border: 2px solid rgba(245,240,232,0.5);
  box-shadow:
    0 0 0 6px rgba(255,255,255,0.04),
    0 25px 60px rgba(0,0,0,0.5),
    inset 0 0 30px rgba(0,0,0,0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transform: rotate(-1.5deg);
  transition: transform 0.6s cubic-bezier(0.4,0,0.2,1);
}
.person-header__photo:hover { transform: rotate(0deg) scale(1.02); }

.person-header__photo::after {
  content: '';
  position: absolute;
  top: -8px; left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 14px;
  background: rgba(200,168,75,0.3);
  border-radius: 1px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.person-header__photo-inner {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(200,168,75,0.14);
  border: 2px solid rgba(200,168,75,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}
.person-header__photo-inner svg {
  width: 50px; height: 50px;
  fill: var(--gold-dim);
  opacity: 0.55;
}

.person-header__info {
  padding-top: 10px;
}

.person-header__eyebrow {
  font-family: var(--font-ui);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 18px;
}

.person-header__name {
  font-family: var(--font-display);
  font-size: clamp(30px, 4.5vw, 48px);
  font-weight: 400;
  color: var(--cream);
  line-height: 1.15;
  margin-bottom: 20px;
  letter-spacing: -0.01em;
}

.person-header__dates {
  font-family: var(--font-body);
  font-size: 22px;
  font-style: italic;
  color: var(--gold-light);
  margin-bottom: 10px;
  letter-spacing: 0.02em;
}
.person-header__dates span {
  display: inline-block;
  margin: 0 14px;
  color: var(--gold-dim);
  transform: translateY(-3px);
}

.person-header__city {
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--cream-dim);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.person-header__city::before {
  content: '◎';
  color: var(--gold-dim);
}

/* ── BIO ── */
.person-bio {
  max-width: 760px;
  margin: 0 auto 80px;
  text-align: center;
  position: relative;
  padding: 30px 40px;
}
.person-bio::before,
.person-bio::after {
  content: '';
  position: absolute;
  left: 50%; transform: translateX(-50%);
  width: 60px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.person-bio::before { top: 0; }
.person-bio::after  { bottom: 0; }

.person-bio__text {
  font-family: var(--font-body);
  font-size: 19px;
  font-weight: 300;
  font-style: italic;
  color: var(--cream-dim);
  line-height: 1.85;
}

/* ── SECTION HEADING ── */
.person-sec-title {
  font-family: var(--font-display);
  font-size: clamp(26px, 3.5vw, 36px);
  font-weight: 400;
  color: var(--cream);
  text-align: center;
  margin-bottom: 40px;
  letter-spacing: -0.01em;
}
.person-sec-title::after {
  content: '';
  display: block;
  width: 40px;
  height: 1px;
  background: var(--gold);
  margin: 14px auto 0;
  opacity: 0.6;
}

/* ── REVIEWS section heading убран, форма стоит одна ── */

/* ── LEAVE REVIEW FORM ── */
.reviews-section {
  margin-bottom: 80px;
}

.review-form {
  max-width: 620px;
  margin: 50px auto 0;
  padding: 36px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(200,168,75,0.14);
  border-radius: 8px;
}

.review-form__title {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--cream);
  text-align: center;
  margin-bottom: 24px;
  font-weight: 400;
}

.review-form__field {
  margin-bottom: 18px;
}

.review-form__input,
.review-form__textarea {
  width: 100%;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(200,168,75,0.2);
  border-radius: 4px;
  padding: 14px 16px;
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 300;
  transition: border-color var(--transition), background var(--transition);
  resize: vertical;
}
.review-form__input:focus,
.review-form__textarea:focus {
  outline: none;
  border-color: var(--gold);
  background: rgba(0,0,0,0.35);
}
.review-form__input::placeholder,
.review-form__textarea::placeholder {
  color: rgba(201,191,168,0.4);
  font-style: italic;
}

.review-form__textarea { min-height: 120px; }

.review-form__submit {
  display: block;
  margin: 8px auto 0;
  padding: 12px 36px;
  font-family: var(--font-body);
  font-size: 14px;
  letter-spacing: 0.12em;
  border-radius: 4px;
  border: none;
  background: linear-gradient(135deg, var(--gold-dim), var(--gold));
  color: var(--black);
  cursor: pointer;
  transition: all var(--transition);
}
.review-form__submit:hover {
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(200,168,75,0.3);
}

/* ── BURIAL / MAP SECTION ── */
.burial-section {
  margin-bottom: 60px;
}

.burial-place {
  text-align: center;
  font-family: var(--font-body);
  font-size: 18px;
  font-style: italic;
  color: var(--cream-dim);
  margin-bottom: 30px;
}
.burial-place::before {
  content: '⚘';
  display: block;
  font-size: 22px;
  color: var(--gold-dim);
  margin-bottom: 10px;
  line-height: 1;
}

.map-frame {
  max-width: 880px;
  margin: 0 auto;
  position: relative;
  border: 3px solid rgba(200,168,75,0.2);
  border-radius: 8px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(200,168,75,0.15),
    0 25px 60px rgba(0,0,0,0.6);
  background: #0e0e0e;
}
.map-frame::before {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 80px rgba(0,0,0,0.7);
  pointer-events: none;
  z-index: 2;
}

.map-frame iframe {
  width: 100%;
  height: 420px;
  display: block;
  filter: sepia(0.25) saturate(0.9) brightness(0.85);
  transition: filter 0.6s;
}
.map-frame:hover iframe { filter: sepia(0.05) saturate(1) brightness(0.95); }

/* Corner ornaments */
.map-frame__corner {
  position: absolute;
  width: 24px; height: 24px;
  border: 2px solid var(--gold);
  opacity: 0.7;
  z-index: 3;
  pointer-events: none;
}
.map-frame__corner--tl { top: 8px; left: 8px; border-right: none; border-bottom: none; }
.map-frame__corner--tr { top: 8px; right: 8px; border-left: none; border-bottom: none; }
.map-frame__corner--bl { bottom: 8px; left: 8px; border-right: none; border-top: none; }
.map-frame__corner--br { bottom: 8px; right: 8px; border-left: none; border-top: none; }

/* ── NOT FOUND ── */
.person-notfound {
  text-align: center;
  padding: 120px 32px;
}
.person-notfound h1 {
  font-family: var(--font-display);
  font-size: 40px;
  color: var(--cream);
  margin-bottom: 20px;
  font-weight: 400;
}
.person-notfound p {
  color: var(--cream-dim);
  font-style: italic;
  margin-bottom: 30px;
}


/* ── Age badge ── */
.person-header__age {
  display: inline-block;
  margin-left: 14px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 300;
  font-style: normal;
  letter-spacing: 0.08em;
  color: var(--gold-dim);
  background: rgba(200,168,75,0.08);
  border: 1px solid rgba(200,168,75,0.2);
  border-radius: 20px;
  padding: 2px 10px;
  vertical-align: middle;
}

/* ═══════════════════════════════════════════════
   ВОСПОМИНАНИЯ БЛИЗКИХ (СЕТКА)
   ═══════════════════════════════════════════════ */

.memories-section {
  margin-bottom: 80px;
}

.memories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  width: 100%;
}

.memories-empty {
  grid-column: 1 / -1;
  text-align: center;
  font-family: var(--font-body);
  font-style: italic;
  color: var(--cream-dim);
  opacity: 0.45;
  padding: 60px 20px;
}

/* Карточка воспоминания */
.memory-card {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.02), rgba(200, 168, 75, 0.03));
  border: 1px solid rgba(200, 168, 75, 0.12);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1),
              box-shadow 0.4s cubic-bezier(0.165, 0.84, 0.44, 1),
              border-color 0.4s ease;
  backdrop-filter: blur(8px);
}

.memory-card:hover {
  transform: translateY(-4px);
  border-color: rgba(200, 168, 75, 0.35);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(200, 168, 75, 0.15);
}

/* Разделенная карточка с фото */
.memory-card__split {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.memory-card__split-media {
  width: 100%;
  aspect-ratio: 16/10;
  overflow: hidden;
  position: relative;
}

.memory-card__split-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.memory-card:hover .memory-card__split-img {
  transform: scale(1.05);
}

.memory-card__split-info {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  gap: 12px;
}

/* Текстовая карточка */
.memory-card__text-only {
  padding: 24px;
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: space-between;
  gap: 16px;
}

/* Бейдж типа */
.memory-card__type-badge {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-dim);
  border: 1px solid rgba(200, 168, 75, 0.2);
  border-radius: 4px;
  padding: 3px 8px;
  align-self: flex-start;
}

/* Текст воспоминания */
.memory-card__text {
  font-family: var(--font-body);
  font-size: 15px;
  font-style: italic;
  font-weight: 300;
  color: var(--cream);
  line-height: 1.65;
  margin: 0;
  position: relative;
}

.memory-card__text::before {
  content: '«';
  color: var(--gold-dim);
  font-size: 1.2em;
  margin-right: 2px;
}

.memory-card__text::after {
  content: '»';
  color: var(--gold-dim);
  font-size: 1.2em;
  margin-left: 2px;
}

/* Автор воспоминания */
.memory-card__author {
  font-family: var(--font-script);
  font-size: 18px;
  color: var(--gold-light);
  margin: 0;
  margin-top: auto;
  align-self: flex-end;
}

.memory-card__author::before {
  content: '— ';
  color: var(--gold-dim);
}


/* ═══════════════════════════════════════════════
   РАСШИРЕННАЯ ФОРМА ВОСПОМИНАНИЙ
   ═══════════════════════════════════════════════ */

/* Вкладки-типы */
.review-type-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.review-type-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 14px;
  font-style: italic;
  color: var(--cream-dim);
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(200,168,75,0.18);
  border-radius: 20px;
  padding: 5px 14px;
  cursor: pointer;
  transition: all 0.3s;
  white-space: nowrap;
}
.review-type-tab:hover {
  border-color: rgba(200,168,75,0.4);
  color: var(--cream);
}
.review-type-tab--active {
  background: linear-gradient(135deg, rgba(200,168,75,0.15), rgba(200,168,75,0.08));
  border-color: var(--gold);
  color: var(--gold-light);
  font-style: normal;
}
.review-type-tab__icon { font-size: 16px; }

/* Поле загрузки фото к воспоминанию */
.review-media-field {
  margin-bottom: 16px;
  display: none; /* показывается при типе фото */
}
.review-media-field.is-visible { display: block; }

.review-media-upload {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(0,0,0,0.25);
  border: 1px dashed rgba(200,168,75,0.2);
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.3s;
}
.review-media-upload:hover { border-color: rgba(200,168,75,0.4); }
.review-media-upload__icon {
  font-size: 22px;
  color: var(--gold-dim);
  flex-shrink: 0;
}
.review-media-upload__text {
  font-family: var(--font-body);
  font-size: 15px;
  font-style: italic;
  color: var(--cream-dim);
  font-weight: 300;
}
.review-media-upload__hint {
  font-family: var(--font-ui);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--gold-dim);
  opacity: 0.6;
  margin-top: 2px;
  text-transform: uppercase;
}
.review-media-upload input { display: none; }

/* Превью перед отправкой */
.review-media-preview {
  display: none;
  margin-top: 10px;
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(200,168,75,0.25);
}
.review-media-preview.is-visible { display: block; }
.review-media-preview img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.review-media-preview__remove {
  position: absolute;
  top: 3px; right: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.65);
  border: 1px solid rgba(200,168,75,0.3);
  color: var(--gold-dim);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: all 0.2s;
}
.review-media-preview__remove:hover { background: rgba(180,60,60,0.5); color: #fff; }

/* Карточка воспоминания с типом */
.review__type-badge {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-dim);
  border: 1px solid rgba(200,168,75,0.2);
  border-radius: 3px;
  padding: 2px 7px;
  margin-bottom: 14px;
}

/* Воспоминание с фото внутри карточки */
.review__media-img {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 16px;
  border: 1px solid rgba(200,168,75,0.12);
}



/* ═══════════════════════════════════════════════
   МОДАЛЬНОЕ ОКНО ПАРОЛЯ ДОСТУПА
   ═══════════════════════════════════════════════ */

.code-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: codeOverlayIn 0.28s ease;
}

@keyframes codeOverlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.code-modal {
  background: rgba(12, 10, 6, 0.98);
  border: 1px solid rgba(200, 168, 75, 0.28);
  border-radius: 12px;
  padding: 52px 48px 44px;
  width: min(460px, 92vw);
  position: relative;
  box-shadow:
    0 0 0 1px rgba(200,168,75,0.08),
    0 40px 100px rgba(0,0,0,0.8),
    0 0 60px rgba(200,168,75,0.06);
  animation: codeModalIn 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
  text-align: center;
}

@keyframes codeModalIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* Золотой разделитель сверху */
.code-modal::before {
  content: '';
  position: absolute;
  top: 0; left: 20%; right: 20%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  border-radius: 0 0 2px 2px;
}

.code-modal__close {
  position: absolute;
  top: 14px; right: 18px;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(200,168,75,0.18);
  background: transparent;
  color: var(--cream-dim);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.3s;
  padding: 0;
}
.code-modal__close:hover {
  border-color: rgba(200,168,75,0.45);
  color: var(--gold-light);
  background: rgba(200,168,75,0.08);
}

/* Иконка-замок */
.code-modal__icon {
  font-size: 36px;
  margin-bottom: 16px;
  display: block;
  animation: lockPulse 2.5s ease-in-out infinite;
}

@keyframes lockPulse {
  0%, 100% { transform: scale(1);    opacity: 0.85; }
  50%      { transform: scale(1.08); opacity: 1; }
}

.code-modal__title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 400;
  color: var(--cream);
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}

.code-modal__sub {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 300;
  font-style: italic;
  color: var(--cream-dim);
  line-height: 1.65;
  margin-bottom: 32px;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

/* Поле кода — крупный моноширинный ввод */
.code-modal__input-wrap {
  position: relative;
  margin-bottom: 8px;
}

.code-modal__input {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(200,168,75,0.22);
  border-radius: 6px;
  padding: 18px 20px;
  color: var(--gold-light);
  font-family: 'Inter', monospace;
  font-size: 26px;
  font-weight: 300;
  letter-spacing: 0.35em;
  text-align: center;
  transition: border-color 0.35s, box-shadow 0.35s, background 0.35s;
  outline: none;
  -webkit-appearance: none;
  caret-color: var(--gold);
}

.code-modal__input::placeholder {
  color: rgba(200,168,75,0.18);
  letter-spacing: 0.3em;
  font-size: 22px;
}

.code-modal__input:focus {
  border-color: var(--gold);
  background: rgba(0,0,0,0.55);
  box-shadow: 0 0 0 3px rgba(200,168,75,0.1), 0 0 24px rgba(200,168,75,0.08);
}

/* Анимация ошибки — трясётся */
.code-modal__input--error {
  border-color: #c85a5a !important;
  box-shadow: 0 0 0 3px rgba(200, 90, 90, 0.15) !important;
  animation: codeShake 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes codeShake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-8px); }
  40%      { transform: translateX(8px); }
  60%      { transform: translateX(-5px); }
  80%      { transform: translateX(5px); }
}

/* Сообщение об ошибке */
.code-modal__error {
  font-family: var(--font-body);
  font-size: 13px;
  font-style: italic;
  color: #e07070;
  min-height: 20px;
  margin-bottom: 16px;
  transition: opacity 0.3s;
}

/* Подсказка — счётчик символов */
.code-modal__hint {
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: rgba(200,168,75,0.35);
  text-transform: uppercase;
  margin-bottom: 24px;
}
.code-modal__hint span {
  color: var(--gold-dim);
  font-weight: 400;
}

/* Кнопка подтверждения */
.code-modal__submit {
  width: 100%;
  padding: 15px;
  font-family: var(--font-body);
  font-size: 15px;
  letter-spacing: 0.14em;
  border-radius: 6px;
  border: none;
  background: linear-gradient(135deg, var(--gold-dim), var(--gold));
  color: var(--black);
  cursor: pointer;
  transition: all 0.35s;
  position: relative;
  overflow: hidden;
}
.code-modal__submit::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--mx,50%) var(--my,50%),
    rgba(255,255,255,0.18) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.code-modal__submit:hover {
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(200,168,75,0.35);
}
.code-modal__submit:hover::before { opacity: 1; }
.code-modal__submit:active { transform: translateY(0); }
.code-modal__submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Текст под кнопкой */
.code-modal__footer {
  margin-top: 20px;
  font-family: var(--font-body);
  font-size: 13px;
  font-style: italic;
  color: rgba(201,191,168,0.4);
  line-height: 1.5;
}
.code-modal__footer a {
  color: var(--gold-dim);
  text-decoration: none;
  transition: color 0.3s;
}
.code-modal__footer a:hover { color: var(--gold-light); }

/* Состояние загрузки — спиннер в кнопке */
.code-modal__submit--loading {
  pointer-events: none;
}
.code-modal__submit--loading::after {
  content: '';
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(0,0,0,0.3);
  border-top-color: var(--black);
  border-radius: 50%;
  margin-left: 8px;
  vertical-align: middle;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Успех — краткая анимация */
.code-modal--success .code-modal__input {
  border-color: #5ab87a;
  box-shadow: 0 0 0 3px rgba(90,184,122,0.15);
  animation: codeSuccess 0.4s ease;
}
@keyframes codeSuccess {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.03); }
  100% { transform: scale(1); }
}


/* ════════════════════════════════════════════
   EDIT MODE — кнопки и инпуты
   ════════════════════════════════════════════ */
.edit-panel {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  gap: 10px;
}

.edit-panel__btn {
  padding: 10px 20px;
  border-radius: 6px;
  border: 1px solid rgba(200,168,75,0.4);
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(10px);
  color: var(--gold-light);
  font-family: var(--font-ui);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s;
}

.edit-panel__btn:hover {
  background: rgba(200,168,75,0.15);
  border-color: var(--gold);
}

.edit-panel__btn--save {
  background: rgba(58,138,90,0.8);
  border-color: rgba(90,184,122,0.5);
  color: #fff;
}

.edit-panel__btn--save:hover {
  background: rgba(58,138,90,1);
}

.edit-panel__btn--cancel {
  border-color: rgba(255,100,100,0.4);
  color: #ff8888;
}

.edit-panel__btn--cancel:hover {
  background: rgba(255,100,100,0.15);
}

/* Инпуты в режиме редактирования */
.edit-input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 4px;
  border: 1px solid rgba(200,168,75,0.3);
  background: rgba(0,0,0,0.6);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.edit-input:focus {
  border-color: var(--gold);
}

.edit-textarea {
  width: 100%;
  min-height: 100px;
  padding: 10px 14px;
  border-radius: 4px;
  border: 1px solid rgba(200,168,75,0.3);
  background: rgba(0,0,0,0.6);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}

.edit-textarea:focus {
  border-color: var(--gold);
}

.edit-img-input {
  width: 100%;
  padding: 6px 10px;
  margin-top: 8px;
  border-radius: 4px;
  border: 1px solid rgba(200,168,75,0.2);
  background: rgba(0,0,0,0.4);
  color: var(--cream-dim);
  font-family: var(--font-ui);
  font-size: 12px;
  outline: none;
}

.edit-img-input:focus {
  border-color: var(--gold);
}


/* ── Кнопка загрузки фото в edit-mode ── */
.edit-photo-upload {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
}

.edit-photo-upload__btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 6px;
  background: rgba(0,0,0,0.75);
  border: 1px solid rgba(200,168,75,0.4);
  color: var(--gold-light);
  font-family: var(--font-ui);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.edit-photo-upload__btn:hover {
  background: rgba(200,168,75,0.2);
  border-color: var(--gold);
}

.edit-photo-upload__status {
  display: block;
  text-align: center;
  font-size: 12px;
  margin-top: 6px;
  color: var(--cream-dim);
  font-family: var(--font-ui);
}

.bio-block__photo--empty-edit {
  flex: 1 1 40%;
  min-width: 0;
  max-width: 320px;
  aspect-ratio: 4 / 3;
  border: 2px dashed rgba(200,168,75,0.3);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: rgba(200,168,75,0.04);
}

.bio-block__photo {
  position: relative;
}


/* ── Панель вставки между блоками (edit mode) ── */
.edit-insert-panel {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 16px 0;
  opacity: 0.4;
  transition: opacity 0.3s;
}

.edit-insert-panel:hover {
  opacity: 1;
}

.edit-insert-btn {
  padding: 8px 20px;
  border-radius: 24px;
  border: 1px dashed rgba(200,168,75,0.4);
  background: rgba(200,168,75,0.05);
  color: var(--gold-light);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: all 0.25s;
}

.edit-insert-btn:hover {
  background: rgba(200,168,75,0.15);
  border-style: solid;
  border-color: var(--gold);
  transform: scale(1.05);
}

.edit-insert-btn--quote {
  border-color: rgba(226,201,126,0.3);
  color: var(--cream-dim);
}

.edit-insert-btn--quote:hover {
  border-color: var(--gold-light);
  color: var(--gold-light);
}

.edit-insert-btn--delete {
  border-color: rgba(255,80,80,0.3);
  color: #ff8888;
  margin-top: 12px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.edit-insert-btn--delete:hover {
  background: rgba(255,80,80,0.12);
  border-color: #ff6666;
  border-style: solid;
}

/* Кнопка удаления существующего блока */
.edit-block-delete {
  display: block;
  margin: 16px auto 0;
  padding: 8px 20px;
  border-radius: 24px;
  border: 1px solid rgba(255,80,80,0.3);
  background: transparent;
  color: #ff8888;
  font-family: var(--font-ui);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.25s;
  opacity: 0.6;
}

.edit-block-delete:hover {
  opacity: 1;
  background: rgba(255,80,80,0.1);
  border-color: #ff6666;
}

.edit-input--block-title {
  text-align: center;
  font-size: 20px;
  margin-bottom: 16px;
  border-color: rgba(200,168,75,0.5);
  color: var(--gold-light);
}

.bio-block--custom-new {
  border: 1px dashed rgba(200,168,75,0.3);
  border-radius: 8px;
  padding: 24px;
  background: rgba(200,168,75,0.03);
}


/* ── Кнопка добавления фото в галерею (edit mode) ── */
.edit-gallery-add {
  text-align: center;
  margin-top: 24px;
}

.edit-gallery-add__btn {
  display: inline-block;
  padding: 10px 24px;
  border-radius: 24px;
  background: rgba(200,168,75,0.08);
  border: 1px dashed rgba(200,168,75,0.4);
  color: var(--gold-light);
  font-family: var(--font-ui);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.25s;
}

.edit-gallery-add__btn:hover {
  background: rgba(200,168,75,0.15);
  border-style: solid;
  border-color: var(--gold);
}

.edit-gallery-add__status {
  display: block;
  text-align: center;
  font-size: 13px;
  margin-top: 8px;
  color: var(--cream-dim);
  font-family: var(--font-ui);
}


/* ── VISIBILITY SELECTOR (edit mode) ── */
.edit-visibility {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.edit-visibility__label {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--gold);
  letter-spacing: 0.03em;
}

.edit-visibility__hint {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--cream-dim);
  opacity: 0.7;
}

.edit-input--select {
  color-scheme: dark !important;
  cursor: pointer;
  background: transparent !important;
  background-color: transparent !important;
}

.edit-input--select:focus,
.edit-input--select:active {
  color-scheme: dark !important;
  background: transparent !important;
  background-color: transparent !important;
  color: var(--cream) !important;
}

.edit-input--select option {
  color-scheme: dark !important;
  background: #12100a !important;
  background-color: #12100a !important;
  color: var(--cream) !important;
}


/* ── GENDER SELECTOR (edit mode) ── */
.edit-gender {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.edit-gender__label {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--gold);
  letter-spacing: 0.03em;
}

.edit-gender__options {
  display: flex;
  gap: 8px;
}

.edit-gender__btn {
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid rgba(200,168,75,0.25);
  background: rgba(255,255,255,0.04);
  color: var(--cream-dim);
  font-family: var(--font-body);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.edit-gender__btn:hover {
  border-color: var(--gold);
  color: var(--cream);
  background: rgba(200,168,75,0.08);
}

.edit-gender__btn--active {
  background: linear-gradient(135deg, var(--gold-dim), var(--gold));
  border-color: var(--gold);
  color: var(--black);
  font-weight: 400;
}

.edit-gender__btn--active:hover {
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
}


/* ── AGE BADGE ── */
.person-header__age-badge {
  display: inline-block;
  margin-top: 10px;
  padding: 6px 14px;
  background: rgba(200,168,75,0.1);
  border: 1px solid rgba(200,168,75,0.3);
  border-radius: 20px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.05em;
  color: var(--gold);
}

/* ── AUDIO & VIDEO PREVIEWS AND LAYOUTS ── */
#review-audio-preview,
#review-video-preview {
  width: 100%;
  height: auto;
  overflow: visible;
  border: none;
  background: transparent;
  padding: 8px 0;
}

#review-audio-preview .review-media-preview__remove,
#review-video-preview .review-media-preview__remove {
  position: absolute;
  top: 0px;
  right: 0px;
  z-index: 5;
}

.memory-card__audio-wrapper audio {
  outline: none;
}

.memory-card__video-wrapper video {
  outline: none;
}


/* AI Assistant Button Styles */
.edit-textarea-wrapper {
  position: relative;
  width: 100%;
}

.ai-assistant-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: all 0.2s ease;
  z-index: 10;
}

.ai-assistant-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
  background: linear-gradient(135deg, #4f46e5 0%, #9333ea 100%);
}

.ai-assistant-btn:active {
  transform: scale(0.95);
}

.ai-voice-btn {
  position: absolute;
  top: 8px;
  right: 42px;
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 11px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: all 0.2s ease;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ai-voice-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
  background: linear-gradient(135deg, #047857 0%, #059669 100%);
}

.ai-voice-btn:active {
  transform: scale(0.95);
}

      .edit-textarea-wrapper .edit-textarea {
        width: 100%;
        padding-right: 76px;
      }

      /* ============================================================
         AI ASSISTANT MODAL & CHAT SYSTEM
         ============================================================ */

      .ai-overlay {
        position: fixed;
        inset: 0;
        background: rgba(8, 8, 8, 0.85);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        z-index: 2000;
        display: flex;
        align-items: center;
        justify-content: center;
        animation: aiOverlayIn 0.3s ease forwards;
      }

      @keyframes aiOverlayIn {
        from { opacity: 0; }
        to   { opacity: 1; }
      }

      .ai-modal {
        background: rgba(12, 10, 6, 0.98);
        border: 1px solid rgba(200, 168, 75, 0.25);
        border-radius: 12px;
        width: min(600px, 94vw);
        height: min(600px, 85vh);
        display: flex;
        flex-direction: column;
        box-shadow: 
          0 0 0 1px rgba(200,168,75,0.08),
          0 20px 80px rgba(0, 0, 0, 0.8),
          0 0 40px rgba(200, 168, 75, 0.05);
        animation: aiModalIn 0.3s cubic-bezier(0.25, 1, 0.5, 1) forwards;
        overflow: hidden;
        position: relative;
      }

      @keyframes aiModalIn {
        from { opacity: 0; transform: scale(0.96) translateY(10px); }
        to   { opacity: 1; transform: scale(1)    translateY(0); }
      }

      .ai-modal::before {
        content: '';
        position: absolute;
        top: 0; left: 15%; right: 15%;
        height: 2px;
        background: linear-gradient(90deg, transparent, var(--gold), transparent);
        border-radius: 0 0 2px 2px;
        z-index: 10;
      }

      .ai-modal__header {
        padding: 16px 20px;
        border-bottom: 1px solid rgba(200, 168, 75, 0.15);
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: rgba(12, 10, 6, 0.95);
        z-index: 2;
      }

      .ai-modal__title {
        font-family: var(--font-display);
        font-size: 19px;
        font-weight: 400;
        color: var(--gold-light);
        display: flex;
        align-items: center;
        gap: 8px;
        letter-spacing: 0.02em;
      }

      .ai-modal__close {
        position: absolute;
        top: 14px;
        right: 18px;
        width: 30px;
        height: 30px;
        border-radius: 50%;
        border: 1px solid rgba(200, 168, 75, 0.15);
        background: transparent;
        color: var(--cream-dim);
        font-size: 16px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s ease;
        z-index: 5;
        padding: 0;
      }

      .ai-modal__close:hover {
        border-color: rgba(200, 168, 75, 0.4);
        color: var(--gold-light);
        background: rgba(200, 168, 75, 0.08);
      }

      .ai-modal__body {
        flex: 1;
        overflow-y: auto;
        padding: 20px;
        display: flex;
        flex-direction: column;
        gap: 16px;
        background: rgba(0, 0, 0, 0.2);
        scrollbar-width: thin;
        scrollbar-color: rgba(200, 168, 75, 0.2) transparent;
      }

      .ai-modal__body::-webkit-scrollbar {
        width: 6px;
      }
      .ai-modal__body::-webkit-scrollbar-thumb {
        background-color: rgba(200, 168, 75, 0.2);
        border-radius: 3px;
      }

      /* Welcome/Initial Flow State */
      .ai-initial-panel {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        height: 100%;
        gap: 20px;
        padding: 30px;
      }

      .ai-initial-panel__icon {
        font-size: 42px;
        animation: aiWandGlow 3s ease-in-out infinite alternate;
      }

      @keyframes aiWandGlow {
        from { transform: scale(1) rotate(0deg); filter: drop-shadow(0 0 2px rgba(99, 102, 241, 0.2)); }
        to   { transform: scale(1.08) rotate(5deg); filter: drop-shadow(0 0 12px rgba(168, 85, 247, 0.6)); }
      }

      .ai-initial-panel__text {
        font-family: var(--font-body);
        font-size: 15px;
        font-style: italic;
        color: var(--cream-dim);
        line-height: 1.6;
        max-width: 380px;
      }

      /* Chat Bubble Layout */
      .ai-chat-bubble {
        max-width: 85%;
        padding: 12px 16px;
        border-radius: 8px;
        font-family: var(--font-ui);
        font-size: 14px;
        line-height: 1.5;
        position: relative;
        word-break: break-word;
        box-shadow: 0 2px 6px rgba(0,0,0,0.15);
      }

      .ai-chat-bubble--assistant {
        background: rgba(200, 168, 75, 0.06);
        border: 1px solid rgba(200, 168, 75, 0.15);
        color: var(--cream);
        align-self: flex-start;
        border-bottom-left-radius: 2px;
      }

      .ai-chat-bubble--user {
        background: rgba(99, 102, 241, 0.12);
        border: 1px solid rgba(99, 102, 241, 0.22);
        color: var(--cream);
        align-self: flex-end;
        border-bottom-right-radius: 2px;
      }

      /* AI Thinking Indicator */
      .ai-thinking {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 8px 12px;
        background: rgba(200, 168, 75, 0.04);
        border: 1px dashed rgba(200, 168, 75, 0.15);
        border-radius: 6px;
        color: var(--gold-light);
        font-family: var(--font-ui);
        font-style: italic;
        font-size: 12px;
        align-self: flex-start;
        animation: pulse 1.5s infinite alternate;
      }

      .ai-thinking__dots {
        display: flex;
        gap: 4px;
        margin-left: 2px;
      }

      .ai-thinking__dot {
        width: 5px;
        height: 5px;
        background: var(--gold);
        border-radius: 50%;
        animation: aiDotBounce 1.4s infinite ease-in-out both;
      }

      .ai-thinking__dot:nth-child(1) { animation-delay: -0.32s; }
      .ai-thinking__dot:nth-child(2) { animation-delay: -0.16s; }

      @keyframes aiDotBounce {
        0%, 80%, 100% { transform: scale(0); }
        40% { transform: scale(1); }
      }

      /* Preview Box for proposed text */
      .ai-preview-box {
        margin: 12px 0 4px;
        background: rgba(0, 0, 0, 0.4);
        border: 1px dashed rgba(200, 168, 75, 0.25);
        border-radius: 6px;
        padding: 12px 14px;
        max-height: 180px;
        overflow-y: auto;
        font-family: var(--font-body);
        font-size: 14px;
        line-height: 1.6;
        color: var(--cream);
        white-space: pre-wrap;
      }

      .ai-preview-title {
        font-family: var(--font-ui);
        font-size: 10px;
        font-weight: 500;
        text-transform: uppercase;
        color: var(--gold);
        letter-spacing: 0.12em;
        margin-bottom: 6px;
        display: flex;
        align-items: center;
        gap: 6px;
      }

      /* Modal Footer and Form Elements */
      .ai-modal__footer {
        padding: 16px 20px;
        border-top: 1px solid rgba(200, 168, 75, 0.15);
        background: rgba(12, 10, 6, 0.95);
        display: flex;
        flex-direction: column;
        gap: 12px;
        z-index: 2;
      }

      .ai-input-row {
        display: flex;
        gap: 8px;
        align-items: center;
      }

      .ai-textarea {
        flex: 1;
        background: rgba(0, 0, 0, 0.5);
        border: 1px solid rgba(200, 168, 75, 0.22);
        border-radius: 6px;
        padding: 10px 14px;
        color: var(--cream);
        font-family: var(--font-ui);
        font-size: 14px;
        line-height: 1.4;
        resize: none;
        height: 40px;
        outline: none;
        transition: all 0.2s ease;
      }

      .ai-textarea:focus {
        border-color: var(--gold);
        background: rgba(0, 0, 0, 0.7);
        box-shadow: 0 0 10px rgba(200, 168, 75, 0.1);
      }

      .ai-textarea::placeholder {
        color: rgba(201, 191, 168, 0.35);
      }

      .ai-btn {
        font-family: var(--font-ui);
        font-size: 13px;
        padding: 8px 16px;
        border-radius: 6px;
        cursor: pointer;
        transition: all 0.2s ease;
        border: none;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        font-weight: 500;
        outline: none;
      }

      .ai-btn--send {
        background: linear-gradient(135deg, var(--gold-dim) 0%, var(--gold) 100%);
        color: var(--black);
        height: 40px;
        width: 40px;
        padding: 0;
        border-radius: 50%;
        flex-shrink: 0;
      }

      .ai-btn--send:hover:not(:disabled) {
        transform: scale(1.05);
        box-shadow: 0 4px 12px rgba(200, 168, 75, 0.2);
      }

      .ai-btn--send:active:not(:disabled) {
        transform: scale(0.95);
      }

      .ai-btn--send:disabled {
        opacity: 0.4;
        cursor: not-allowed;
      }

      .ai-btn--primary {
        background: linear-gradient(135deg, var(--gold-dim) 0%, var(--gold) 100%);
        color: var(--black);
      }
      .ai-btn--primary:hover:not(:disabled) {
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(200, 168, 75, 0.25);
      }
      .ai-btn--primary:active:not(:disabled) {
        transform: translateY(0);
      }

      .ai-btn--secondary {
        background: rgba(255, 255, 255, 0.04);
        border: 1px solid rgba(200, 168, 75, 0.3);
        color: var(--gold-light);
      }
      .ai-btn--secondary:hover:not(:disabled) {
        background: rgba(200, 168, 75, 0.08);
        border-color: var(--gold);
      }

      .ai-btn--danger {
        background: transparent;
        border: 1px solid rgba(255, 80, 80, 0.3);
        color: #ff8888;
      }
      .ai-btn--danger:hover:not(:disabled) {
        background: rgba(255, 80, 80, 0.1);
        border-color: #ff6666;
      }

      .ai-action-buttons {
        display: flex;
        gap: 8px;
        justify-content: flex-end;
      }

      /* Mobile Adaptability */
      @media (max-width: 576px) {
        .ai-modal {
          width: 100%;
          height: 100%;
          border: none;
          border-radius: 0;
        }
        .ai-overlay {
          padding: 0;
        }
        .ai-chat-bubble {
          max-width: 90%;
        }
        .ai-action-buttons {
          flex-wrap: wrap;
        }
        .ai-btn {
          flex: 1 1 calc(50% - 4px);
          font-size: 12px;
          padding: 10px;
        }
      }

      /* AI Voice Assistant Custom Styles */
      .ai-voice-container {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 20px 8px;
        text-align: center;
        gap: 18px;
        width: 100%;
      }
      
      .ai-voice-mic-wrapper {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 15px 0;
        width: 100px;
        height: 100px;
      }
      
      .ai-voice-progress-svg {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) rotate(-90deg);
        width: 96px;
        height: 96px;
        pointer-events: none;
        z-index: 1;
      }
      
      .ai-voice-progress-bg {
        stroke: rgba(255, 255, 255, 0.08);
      }
      
      .ai-voice-progress-bar {
        stroke: #10b981;
        transition: stroke-dashoffset 0.1s linear, stroke 0.3s ease;
      }

      .ai-voice-mic-circle--listening ~ .ai-voice-progress-svg .ai-voice-progress-bar {
        stroke: #ef4444;
      }
      
      .ai-voice-mic-circle {
        width: 80px;
        height: 80px;
        border-radius: 50%;
        background: linear-gradient(135deg, #059669 0%, #10b981 100%);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4), 0 6px 20px rgba(5, 150, 105, 0.3);
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-size: 32px;
        cursor: pointer;
        transition: all 0.3s ease;
        animation: micPulse 2s infinite;
        z-index: 2;
        border: none;
        outline: none;
      }

      .ai-voice-mic-circle--listening {
        background: linear-gradient(135deg, #dc2626 0%, #f87171 100%);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5), 0 6px 20px rgba(220, 38, 38, 0.4);
        animation: micPulseListening 1.5s infinite;
      }
      
      .ai-voice-mic-pulse-ring {
        position: absolute;
        width: 80px;
        height: 80px;
        border-radius: 50%;
        border: 2px solid #10b981;
        opacity: 0.8;
        animation: micPulseRing 2s infinite;
        pointer-events: none;
        z-index: 1;
      }

      .ai-voice-mic-circle--listening + .ai-voice-mic-pulse-ring {
        border-color: #ef4444;
        animation: micPulseRingListening 1.5s infinite;
      }
      
      .ai-voice-status-text {
        font-family: var(--font-display, inherit);
        font-size: 18px;
        color: var(--cream, #f1ead7);
        font-weight: 500;
        margin: 0;
        letter-spacing: 0.5px;
      }

      .ai-voice-status-text--listening {
        color: #ef4444;
        animation: textFlicker 1.5s infinite alternate;
      }
      
      .ai-voice-waves-container {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
        height: 30px;
        margin: 5px 0;
      }
      
      .ai-voice-wave-bar {
        width: 3px;
        height: 6px;
        background: #10b981;
        border-radius: 2px;
        transition: height 0.1s ease;
      }

      .ai-voice-mic-circle--listening ~ .ai-voice-waves-container .ai-voice-wave-bar {
        background: #ef4444;
        animation: waveBounce 1s infinite ease-in-out;
      }

      .ai-voice-waves-container .ai-voice-wave-bar:nth-child(1) { animation-delay: 0.1s; }
      .ai-voice-waves-container .ai-voice-wave-bar:nth-child(2) { animation-delay: 0.2s; }
      .ai-voice-waves-container .ai-voice-wave-bar:nth-child(3) { animation-delay: 0.3s; }
      .ai-voice-waves-container .ai-voice-wave-bar:nth-child(4) { animation-delay: 0.4s; }
      .ai-voice-waves-container .ai-voice-wave-bar:nth-child(5) { animation-delay: 0.5s; }
      .ai-voice-waves-container .ai-voice-wave-bar:nth-child(6) { animation-delay: 0.4s; }
      .ai-voice-waves-container .ai-voice-wave-bar:nth-child(7) { animation-delay: 0.3s; }
      .ai-voice-waves-container .ai-voice-wave-bar:nth-child(8) { animation-delay: 0.2s; }
      .ai-voice-waves-container .ai-voice-wave-bar:nth-child(9) { animation-delay: 0.1s; }
      
      .ai-voice-transcript-box {
        width: 100%;
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 12px;
        padding: 14px;
        min-height: 80px;
        max-height: 140px;
        overflow-y: auto;
        color: rgba(255, 255, 255, 0.85);
        font-family: var(--font-body, inherit);
        font-size: 14px;
        line-height: 1.6;
        text-align: left;
        box-shadow: inset 0 2px 4px rgba(0,0,0,0.15);
      }

      .ai-voice-transcript-box:empty::before {
        content: "Начните говорить, ваша речь появится здесь...";
        color: rgba(255, 255, 255, 0.3);
        font-style: italic;
      }
      
      .ai-voice-instruction {
        font-size: 11px;
        color: rgba(255, 255, 255, 0.4);
        margin: 0;
      }
      
      @keyframes micPulse {
        0% {
          transform: scale(1);
          box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4), 0 6px 20px rgba(5, 150, 105, 0.3);
        }
        70% {
          transform: scale(1.04);
          box-shadow: 0 0 0 12px rgba(16, 185, 129, 0), 0 6px 20px rgba(5, 150, 105, 0.3);
        }
        100% {
          transform: scale(1);
          box-shadow: 0 0 0 0 rgba(16, 185, 129, 0), 0 6px 20px rgba(5, 150, 105, 0.3);
        }
      }

      @keyframes micPulseListening {
        0% {
          transform: scale(1);
          box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5), 0 6px 20px rgba(220, 38, 38, 0.4);
        }
        70% {
          transform: scale(1.08);
          box-shadow: 0 0 0 16px rgba(239, 68, 68, 0), 0 6px 20px rgba(220, 38, 38, 0.4);
        }
        100% {
          transform: scale(1);
          box-shadow: 0 0 0 0 rgba(239, 68, 68, 0), 0 6px 20px rgba(220, 38, 38, 0.4);
        }
      }
      
      @keyframes micPulseRing {
        0% {
          transform: scale(1);
          opacity: 0.8;
        }
        100% {
          transform: scale(1.5);
          opacity: 0;
        }
      }

      @keyframes micPulseRingListening {
        0% {
          transform: scale(1);
          opacity: 0.9;
        }
        100% {
          transform: scale(1.7);
          opacity: 0;
        }
      }
      
      @keyframes waveBounce {
        0%, 100% {
          height: 6px;
        }
        50% {
          height: 24px;
        }
      }

      @keyframes textFlicker {
        0% { opacity: 0.5; }
        100% { opacity: 1; }
      }

      .ai-voice-diff-container {
        display: flex;
        flex-direction: column;
        gap: 12px;
        width: 100%;
        text-align: left;
      }

      .ai-voice-diff-item {
        background: rgba(255, 255, 255, 0.02);
        border: 1px solid rgba(255, 255, 255, 0.05);
        border-radius: 8px;
        padding: 12px;
      }

      .ai-voice-diff-label {
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: var(--gold-light, #e6cf86);
        margin-bottom: 6px;
        font-weight: bold;
      }

      .ai-voice-diff-text {
        font-size: 13.5px;
        line-height: 1.5;
        color: rgba(255, 255, 255, 0.9);
      }

/* ════════════════════════════════════════════════════════════════
   EDITOR POLISH — Design Engineering pass (принципы Emil Kowalski)
   Режим редактирования страницы памяти. Цели:
   • кнопки AI/🎙️ не перекрывают текст и едины со стилем темы
   • точки вставки «+ Блок / + Цитата» читаются как кнопки
   • тактильный отклик (scale на :active), корректные кривые/тайминги (<300ms)
   • hover-эффекты только на мыши; уважение prefers-reduced-motion
   ════════════════════════════════════════════════════════════════ */
:root {
  /* Сильные кастомные кривые (встроенные CSS-easing слишком слабые) */
  --ease-out-strong: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out-strong: cubic-bezier(0.77, 0, 0.175, 1);
  --edit-dur-press: 140ms;
  --edit-dur-ui: 200ms;
}

/* ── 1. AI / 🎙️ — компактный тулбар под полем, без наложения на текст ── */
.edit-textarea-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end; /* кнопки прижаты вправо во второй строке */
  align-items: center;
}
.edit-textarea-wrapper .edit-textarea {
  flex: 1 1 100%;            /* поле занимает всю первую строку */
  padding: 10px 14px;        /* сброс прежнего padding-right:76px */
}
.edit-textarea-wrapper .ai-voice-btn,
.edit-textarea-wrapper .ai-assistant-btn {
  position: static;          /* убираем absolute поверх текста */
  top: auto;
  right: auto;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 28px;
  padding: 0 12px;
  border-radius: 8px;
  background: rgba(200, 168, 75, 0.10);
  border: 1px solid rgba(200, 168, 75, 0.32);
  color: var(--gold-light, #e6cf86);
  box-shadow: none;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  opacity: 0.55;             /* ненавязчиво в покое */
  cursor: pointer;
  transition: opacity var(--edit-dur-ui) var(--ease-out-strong),
              background-color var(--edit-dur-ui) var(--ease-out-strong),
              border-color var(--edit-dur-ui) var(--ease-out-strong),
              transform var(--edit-dur-press) var(--ease-out-strong);
}
.edit-textarea-wrapper .ai-voice-btn {
  padding: 0 10px;
  font-size: 13px;
}
/* раскрываем кнопки при фокусе/наведении на поле */
.edit-textarea-wrapper:hover .ai-voice-btn,
.edit-textarea-wrapper:hover .ai-assistant-btn,
.edit-textarea-wrapper:focus-within .ai-voice-btn,
.edit-textarea-wrapper:focus-within .ai-assistant-btn {
  opacity: 1;
}
@media (hover: hover) and (pointer: fine) {
  .edit-textarea-wrapper .ai-voice-btn:hover,
  .edit-textarea-wrapper .ai-assistant-btn:hover {
    background: rgba(200, 168, 75, 0.20);
    border-color: var(--gold, #c8a84b);
  }
}
.edit-textarea-wrapper .ai-voice-btn:active,
.edit-textarea-wrapper .ai-assistant-btn:active {
  transform: scale(0.96); /* тактильный отклик на нажатие */
}

/* === Единая диктовка всей истории (полноценная фича ИИ-структурирования) === */
.full-story-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(200,168,75,0.18);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 28px;
}
.full-story-header {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}
.full-story-icon {
  font-size: 42px;
  line-height: 1;
  opacity: 0.9;
}
.full-story-title {
  margin: 0 0 6px;
  font-size: 1.32rem;
  color: #f0e9d6;
  font-weight: 600;
}
.full-story-subtitle {
  margin: 0;
  font-size: 0.95rem;
  color: rgba(240,233,214,0.72);
  line-height: 1.45;
}
.full-story-controls {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.full-story-status {
  flex: 1;
  min-width: 200px;
}
.full-story-transcript-wrapper {
  margin-bottom: 16px;
}
.full-story-transcript {
  min-height: 130px;
  font-size: 15px;
  line-height: 1.55;
  resize: vertical;
  width: 100%;
  box-sizing: border-box;
}
.full-story-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.full-story-result {
  margin-top: 16px;
  padding: 14px 18px;
  background: rgba(16,185,129,0.08);
  border: 1px solid rgba(16,185,129,0.25);
  border-radius: 12px;
  font-size: 0.95rem;
  color: #a7f3d0;
}

/* ── 2. Панели вставки «+ Блок / + Цитата» — читаемая точка вставки ── */
.edit-insert-panel {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 14px 0;
  position: relative;
  opacity: 0.6;
  transition: opacity var(--edit-dur-ui) var(--ease-out-strong);
}
.edit-insert-panel::before { /* тонкая линия-разделитель за кнопками */
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(200, 168, 75, 0.22), transparent);
  z-index: 0;
}
.edit-insert-panel:hover { opacity: 1; }
.edit-insert-panel .edit-insert-btn { position: relative; z-index: 1; }

.edit-insert-btn {
  padding: 7px 18px;
  border-radius: 20px;
  border: 1px solid rgba(200, 168, 75, 0.45); /* solid вместо dashed — читается как кнопка */
  background: rgba(20, 16, 10, 0.85);          /* непрозрачный фон поверх линии */
  color: var(--gold-light);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background-color var(--edit-dur-ui) var(--ease-out-strong),
              border-color var(--edit-dur-ui) var(--ease-out-strong),
              color var(--edit-dur-ui) var(--ease-out-strong),
              transform var(--edit-dur-press) var(--ease-out-strong);
}
.edit-insert-btn:hover { /* база (в т.ч. touch): без «залипающего» scale */
  background: rgba(200, 168, 75, 0.16);
  border-color: var(--gold);
  transform: none;
}
@media (hover: hover) and (pointer: fine) {
  .edit-insert-btn:hover { transform: translateY(-1px); } /* лёгкий лифт на мыши */
}
.edit-insert-btn:active { transform: scale(0.97); }

/* ── 3. Кнопки удаления — единый стиль и отклик ── */
.edit-insert-btn--delete {
  margin-top: 14px;
  background: rgba(40, 14, 14, 0.7);
}
.edit-block-delete {
  transition: opacity var(--edit-dur-ui) var(--ease-out-strong),
              background-color var(--edit-dur-ui) var(--ease-out-strong),
              border-color var(--edit-dur-ui) var(--ease-out-strong),
              transform var(--edit-dur-press) var(--ease-out-strong);
}
.edit-block-delete:active { transform: scale(0.97); }

/* ── 4. Загрузка фото — понятная зона/кнопка ── */
.bio-block__photo--empty-edit {
  transition: border-color var(--edit-dur-ui) var(--ease-out-strong),
              background-color var(--edit-dur-ui) var(--ease-out-strong);
}
@media (hover: hover) and (pointer: fine) {
  .bio-block__photo--empty-edit:hover {
    border-color: rgba(200, 168, 75, 0.55);
    background: rgba(200, 168, 75, 0.07);
  }
}
.bio-block__photo--empty-edit .edit-photo-upload { /* центрируем кнопку внутри пустого слота */
  position: static;
  transform: none;
}
.edit-photo-upload__btn,
.edit-gallery-add__btn {
  transition: background-color var(--edit-dur-ui) var(--ease-out-strong),
              border-color var(--edit-dur-ui) var(--ease-out-strong),
              transform var(--edit-dur-press) var(--ease-out-strong);
}
.edit-photo-upload__btn:active,
.edit-gallery-add__btn:active { transform: scale(0.97); }

/* ── Доступность: меньше движения при prefers-reduced-motion ── */
@media (prefers-reduced-motion: reduce) {
  .edit-insert-btn,
  .edit-textarea-wrapper .ai-voice-btn,
  .edit-textarea-wrapper .ai-assistant-btn,
  .edit-photo-upload__btn,
  .edit-gallery-add__btn,
  .edit-block-delete {
    transition-property: opacity, background-color, border-color, color;
  }
  .edit-insert-btn:active,
  .edit-insert-btn:hover,
  .edit-textarea-wrapper .ai-voice-btn:active,
  .edit-textarea-wrapper .ai-assistant-btn:active,
  .edit-photo-upload__btn:active,
  .edit-gallery-add__btn:active,
  .edit-block-delete:active { transform: none; }
}


