@font-face {
  font-family: "Arial";
  src: url("./assets/fonts/Arial.ttf") format("truetype");
  font-weight: 400;
  font-display: block;
}

@font-face {
  font-family: "Arial Black";
  src: url("./assets/fonts/Arial Black.ttf") format("truetype");
  font-weight: 900;
  font-display: block;
}

@font-face {
  font-family: "Courier New";
  src: url("./assets/fonts/Courier New.ttf") format("truetype");
  font-weight: 400;
  font-display: block;
}

@font-face {
  font-family: "Courier New Bold";
  src: url("./assets/fonts/Courier New Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: block;
}

@font-face {
  font-family: "Times New Roman";
  src: url("./assets/fonts/Times New Roman.ttf") format("truetype");
  font-weight: 400;
  font-display: block;
}

@font-face {
  font-family: "Times New Roman Bold";
  src: url("./assets/fonts/Times New Roman Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: block;
}

@font-face {
  font-family: "Alegreya Sans SC";
  src: url("./assets/fonts/Alegreya Sans SC.ttf") format("truetype");
  font-display: block;
}

@font-face {
  font-family: "Denistina";
  src: url("./assets/fonts/denistina.ttf") format("truetype");
  font-display: block;
}

@font-face {
  font-family: "Inter";
  src: url("./assets/fonts/Inter.otf") format("opentype");
  font-display: block;
}

@font-face {
  font-family: "Montserrat";
  src: url("./assets/fonts/Montserrat-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: "Montserrat Bold";
  src: url("./assets/fonts/Montserrat-Black.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}


.page-slot.drop-target {
  outline: 3px solid #ff5181;
  outline-offset: 4px;
}





.loading-title {
  margin-top: 18px;
  font-size: 18px;
  line-height: 1.25;
  font-weight: 700;
  color: #242428;
  text-align: center;
}

.loading-subtitle {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 400;
  color: #949494;
  text-align: center;
}

.loading-note {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 400;
  color: #949494;
  text-align: center;
}




.spine-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 1000000000000;
  align-items: center;
  justify-content: center;
}

.spine-modal.open {
  display: flex;
}

.spine-modal-box {
  width: 360px;
  max-width: calc(100vw - 32px);
  background: #fff;
  border-radius: 22px;
  padding: 22px;
  box-shadow: 0 18px 60px rgba(0,0,0,.18);
}

.spine-modal-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 14px;
}

.spine-modal-input {
  width: 100%;
  height: 48px;
  border: 1px solid #e5e5e5;
  border-radius: 14px;
  padding: 0 14px;
  font-size: 16px;
  outline: none;
  box-sizing: border-box;
}

.spine-modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.spine-modal-actions button {
  flex: 1;
  height: 44px;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 600;
}

.spine-modal-cancel {
  background: #f3f3f3;
  color: #333;
}

.spine-modal-save {
  background: #ff5a8a;
  color: #fff;
}






#loadingOverlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(255, 255, 255, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  font-family: "Montserrat", Arial, sans-serif;
}

.loading-box {
  background: #ffffff;
  padding: 26px 32px;
  border-radius: 22px;
  box-shadow: 0 14px 45px rgba(255, 160, 186, 0.35);
  font-size: 18px;
  font-weight: 600;
  color: #2b2b2b;
  text-align: center;
  min-width: 240px;
}

.loading-spinner {
  width: 38px;
  height: 38px;
  border: 4px solid #ffe1ea;
  border-top-color: #ffa0ba;
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}

#loadingOverlayText {
  font-family: "Montserrat", Arial, sans-serif;
  letter-spacing: -0.2px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}





.upload-toast {
  position: fixed;

  right: 20px;
  bottom: 20px;

  width: 240px;

  padding: 14px;

  background: rgba(255, 255, 255, 0.92);

  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);

  border-radius: 16px;

  box-shadow:
    0 8px 32px rgba(0,0,0,0.12);

  z-index: 999999999;

  opacity: 0;

  transform: translateY(30px);

  pointer-events: none;

  transition: all 0.25s ease;
}

.upload-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.upload-toast-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  font-weight: 600;

  color: #222;

  margin-bottom: 10px;
}

.upload-toast-bar {
  height: 6px;

  border-radius: 999px;

  overflow: hidden;

  background: rgba(0,0,0,0.08);
}

.upload-toast-progress {
  width: 40%;
  height: 100%;

  border-radius: 999px;

  background: #FF5181;

  animation: uploadMove 1s infinite linear;
}

@keyframes uploadMove {
  0% {
    transform: translateX(-120%);
  }

  100% {
    transform: translateX(350%);
  }
}

.photo-upload-badge {
  position: absolute;
  left: 8px;
  top: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  font-weight: 500;
  z-index: 9999;
  pointer-events: none;
}

.photo-upload-badge.error {
  background: rgba(255,59,48,0.88);
}

.page-slot {
  position: absolute;
}




.project-delete-btn:hover {
  background: #ffd9d9;
}

.project-delete-btn svg {
  width: 25px;
  height: 25px;
}





.leave-warning-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.35);
  z-index: 999999999;
}

.leave-warning-modal.open {
  display: flex;
}

.leave-warning-card {
  width: 320px;
  background: #fff;
  border-radius: 20px;
  padding: 24px;
  text-align: center;
  font-family: 'Montserrat', sans-serif;
  box-shadow: 0 20px 60px rgba(0,0,0,0.22);
}

.leave-warning-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.leave-warning-text {
  margin-top: 10px;
  font-size: 14px;
  color: #777;
  line-height: 1.4;
}

.leave-warning-actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}

#stayOnEditorBtn,
#leaveAnywayBtn {
  flex: 1;
  border: none;
  border-radius: 12px;
  padding: 11px 10px;
  cursor: pointer;
  font-family: 'Montserrat', sans-serif;
}

#stayOnEditorBtn {
  background: #f3f3f3;
  color: #444;
}

#leaveAnywayBtn {
  background: #FF5181;
  color: #fff;
}


.save-status-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.75);
  z-index: 99999999;
}

.save-status-modal.open {
  display: flex;
}

.save-status-card {
  width: 300px;
  background: #fff;
  border-radius: 18px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 18px 50px rgba(0,0,0,0.18);
  font-family: 'Montserrat', sans-serif;
}

.save-status-spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto 14px;
  border: 3px solid #f1d4dc;
  border-top-color: #FF5181;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.save-status-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.save-status-text {
  margin-top: 8px;
  font-size: 14px;
  color: #777;
}

.save-status-modal.done .save-status-spinner {
  animation: none;
  border: none;
}

.save-status-modal.done .save-status-spinner::before {
  content: "✓";
  display: block;
  font-size: 34px;
  color: #FF5181;
  line-height: 34px;
}


#projectLoader {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.95);

  display: none;
  align-items: center;
  justify-content: center;

  z-index: 99999999;
}

.editor-header {
  height: 45px;
  background: #fff;
  border-bottom: 1px solid #e8e8e8;

  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 0 24px;
  box-sizing: border-box;
}

.editor-logo {
  font-family: 'Montserrat', sans-serif;
  font-size: 25px;
  font-weight: 500;
  color: #ff5f8a; 
  text-decoration: none;
}

.editor-project-name {
  margin-top: 5px;
  font-family: 'Montserrat', sans-serif;
  font-size: 18px;
  font-weight: 500;
  color: #444;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);

  max-width: 400px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-header-actions {
  display: flex;
  gap: 24px;
}

.header-btn {
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0px;

  color: #FFA0BA;
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
}

.header-btn svg {
  width: 15px;
  height: 15px;
}

.header-btn:hover {
  opacity: 0.8;
}

.projects-modal-card h3 {
  margin: 0 0 10px;
  font-size: 24px;
  font-weight: 700;
  font-family: Arial, sans-serif;
}

.projects-modal-card p {
  margin: 0 0 20px;
  color: #666;
  line-height: 1.4;
  
}

.projects-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  font-family: inherit;
  font-family: Arial, sans-serif;
}

.projects-modal.open {
  display: flex;
}

.projects-modal-card {
  position: relative;

  width: min(
    420px,
    calc(100vw - 32px)
  );

  max-height: calc(
    100dvh - 32px
  );

  display: flex;
  flex-direction: column;

  padding: 24px;
  box-sizing: border-box;

  background: #fff;
  border-radius: 20px;

  overflow: hidden;

  box-shadow:
    0 20px 60px
    rgba(0, 0, 0, 0.25);
}

/*
 * Прокручивается только список проектов.
 * Заголовок и кнопка создания проекта
 * остаются на месте.
 */
#projectsList {
  flex: 1 1 auto;

  min-height: 0;
  max-height: 430px;

  overflow-y: auto;
  overflow-x: hidden;

  margin-right: -8px;
  padding-right: 8px;

  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;

  scrollbar-gutter: stable;
}
#projectsList
.project-item:last-child {
  border-bottom: none;
}


.project-item button,
#createNewProjectBtn {
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  background: #FF5181;
  color: white;
  cursor: pointer;
}

.project-title {
  flex: 1;
  min-width: 0;

  display: flex;
  align-items: baseline;
  flex-wrap: wrap;

  gap: 5px;
}

.project-title__name {
  min-width: 0;

  font-size: 15px;
  font-weight: 500;
  color: #222;

  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-title__id {
  flex-shrink: 0;

  font-size: 11px;
  font-weight: 400;
  color: #aaa;

  white-space: nowrap;
}




.project-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid #eee;
}


.project-item > div:first-child {
  flex: 1;
  min-width: 0;
}


.project-actions {
  display: flex;
  flex-direction: row !important;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-left: auto;
  flex-shrink: 0;
}

.project-open-btn {
  width: auto !important;
  height: 45px;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 600;

  border: none;
  border-radius: 12px;
  padding: 0 18px;
  background: #FF5181;
  color: white;
  cursor: pointer;
}

.project-delete-btn {
  width: 45px !important;
  height: 45px !important;
  padding: 0 !important;

  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;

  border: none;
  border-radius: 12px;

  background: #FF5181;
  color: white;

  cursor: pointer;
}






#createNewProjectBtn {
  width: 100%;
  margin-top: 18px;
  flex-shrink: 0;
}

.projects-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;

  width: 32px;
  height: 32px;

  border: none;
  background: transparent;

  cursor: pointer;
  color: #999;

  display: flex;
  align-items: center;
  justify-content: center;
}

.projects-modal-close:hover {
  color: #333;
}

  
#photoBookApp {
  width: 100%;
  height: 93vh;
  background: #f5f5f5;
  font-family: Arial, sans-serif;

  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);

  overflow: hidden;
}

    .left-panel {
      min-width: 0;
      background: #fff;
      border-right: 1px solid #ddd;
      padding: 16px;
      overflow-y: auto;
    }

    .center-panel {
  position: relative;

  display: flex;
  flex-direction: column;

  align-items: center;
  justify-content: center;

  overflow: hidden;

  min-width: 0;
  min-height: 0;

  box-sizing: border-box;
}
    

.top-actions {
  position: absolute;

  top: 15px;
  left: 15px;
  right: 15px;

  display: flex;
  justify-content: space-between;
  align-items: flex-start;

  z-index: 20;
}

.text-toolbar {
  display:flex;
  gap:10px;
  align-items:center;
}

.export-toolbar {
  display:flex;
  gap:10px;
  align-items:center;
}

    .save-btn {
      background: #FF5181;
      color: #fff;
      border: none;
      padding: 11px 18px;
      border-radius: 10px;
      font-size: 15px;
      cursor: pointer;
    }

    .templates-title {
      font-size: 16px;
      font-weight: 600;
      margin-bottom: 14px;
    }

.templates-grid {
  width: 100%;

  display: grid;
  grid-template-columns: minmax(0, 1fr);

  gap: 18px;

  padding-bottom: 30px;
  box-sizing: border-box;
}

.template-card {
  position: relative;

  width: 100%;
  height: 220px;
  min-width: 0;

  background: #ffffff;

  border: 1px solid #dedede;
  border-radius: 0;

  box-sizing: border-box;
  overflow: hidden;

  cursor: pointer;

  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.template-card:hover {
  border-color: #ffa0ba;
  transform: translateY(-1px);

  box-shadow:
    0 7px 18px rgba(0, 0, 0, 0.07);
}

.template-card.active {
  border: 2px solid #ff5181;

  box-shadow:
    0 0 0 2px rgba(255, 81, 129, 0.1);
}

.photo-format-card {
  appearance: none;
  -webkit-appearance: none;

  width: 100%;
  height: auto;
  min-width: 0;

  padding: 0;

  display: flex;
  flex-direction: column;
  align-items: stretch;

  gap: 9px;

  border: none;
  border-radius: 0;

  background: transparent;
  box-shadow: none;

  overflow: visible;

  font: inherit;
  color: inherit;
  text-align: center;

  cursor: pointer;
}

.photo-format-card:hover {
  border: none;
  box-shadow: none;
  transform: none;
}

.photo-format-card__preview {
  position: static;

  width: 100%;
  height: auto;

  display: block;

  overflow: visible;
}

.photo-format-card__image {
  width: 100%;
  height: auto;

  max-width: none;
  max-height: none;

  display: block;

  object-fit: contain;

  pointer-events: none;
  user-select: none;

  transition: opacity 0.15s ease;
}

.photo-format-card:hover
.photo-format-card__image {
  opacity: 0.88;
}

.photo-format-card__title {
  position: static;

  width: 100%;

  padding: 0 4px;

  box-sizing: border-box;

  font-size: 14px;
  font-weight: 500;
  line-height: 1.25;

  color: #222222;
  text-align: center;

  pointer-events: none;
}

.photo-format-card.active {
  border: none;
  box-shadow: none;
}

.photo-format-card.active
.photo-format-card__title {
  color: #ff5181;
  font-weight: 600;
}

.photo-format-card:focus-visible {
  outline: 2px solid #ff5181;
  outline-offset: 4px;
}

.template-slot-preview {
  position: absolute;
  background: #d6d6d6;
  border: 0.5px solid rgba(120,120,120,.35);
  box-sizing: border-box;
}

    .book-spread {
      display: flex;
      background: #fff;
      border: 1px solid #ddd;
      box-shadow: 0 6px 20px rgba(0,0,0,.06);
    }

.page-slot.selected {
  box-shadow: inset 0 0 0 1px #FF5181;
  z-index: 1000 !important;
}

    .page {
      width: 360px;
      height: 406px;
      background: #fff;
      position: relative;
      overflow: hidden;
      border: 0.5px solid transparent;
      cursor: pointer;
    }

  .page-number {
  cursor: pointer;
}

    .page-slot {
      position: absolute;
      overflow: hidden;
      background: #d8d8d8;
      border: none;
    }

    .page-slot img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      user-select: none;
      cursor: pointer;
      transform-origin: center center;
    }

    .add-photo {
      position: absolute;
      top: 50%;
      left: 50%;
      width: 52px;
      height: 52px;
      transform: translate(-50%, -50%);
      border-radius: 50%;
      background: rgba(255,255,255,.9);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 34px;
      cursor: pointer;
      color: #222;
    }

    .page-slot img {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}

.history-btn {
  width: 38px;
  height: 38px;

  padding: 0;

  display: flex;
  align-items: center;
  justify-content: center;
}

.history-btn svg {
  width: 18px;
  height: 18px;

  fill: none;
  stroke: white;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.text-box {
  touch-action: none;
}

    .page-numbers {
      display: flex;
      gap: 330px;
      margin-top: 16px;
      justify-content: center;
    }

    .page-number {
      width: 42px;
      height: 42px;
      border-radius: 6px;
      background: #fff;
      border: 1px solid #ccc;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 14px;
    }

    .page-number.active {
      background: #FF5181;
      color: #fff;
      border-color: #FF5181;
    }

    .thumb-spread {
      display: flex;
      gap: 4px;
      margin-bottom: 14px;
      cursor: pointer;
      justify-content: center;
    }

    .thumb-page {
      width: 78px;
      height: 104px;
      background: #eee;
      border: 1px solid #ddd;
      position: relative;
      overflow: hidden;
    }

    .thumb-page.active {
      border: 2px solid #FF5181;
    }

    .thumb-slot {
      position: absolute;
      background: #cfcfcf;
    }

    .thumb-label {
      text-align: center;
      font-size: 12px;
      color: #555;
      margin-top: -8px;
      margin-bottom: 12px;
    }
    


.client-input {
  width: 100%;
  height: 48px;
  margin-bottom: 10px;
  border: none;
  border-radius: 16px;
  background: #f5f5f5;
  padding: 0 14px;
  font-size: 16px;
  box-sizing: border-box;
}

  .export-toolbar .save-btn:not(:last-child) {
    background: #f1f1f1;
    color: #222;
  }

  .export-toolbar .history-btn svg {
    stroke: #555;
  }
  
  .selected-cover-box{
  margin-bottom:16px;
  padding:12px;
  background:#f5f5f5;
  border-radius:16px;
}

.selected-cover-title{
  font-size:13px;
  color:#777;
  margin-bottom:8px;
}

.selected-cover-box img{
  width:100%;
  border-radius:12px;
  display:block;
}

.selected-cover-name{
  margin-top:8px;
  font-size:14px;
  font-weight:600;
  color:#222;
}

.cover-photo-slot{
  position:absolute;
  background:linear-gradient(#f8f8f8, #999);
  display:flex;
  align-items:center;
  justify-content:center;
  color:#777;
  font-size:28px;
  z-index:300;
  cursor:pointer;
}

.templates-switch{
  display:flex;
  gap:6px;
  margin-bottom:14px;
}

.templates-tab{
  flex:1;
  height:38px;
  border:none;
  border-radius:12px;
  background:#f1f1f1;
  color:#222;
  font-size:14px;
  cursor:pointer;
}

.templates-tab.active{
  background:#FF5181;
  color:#fff;
}


#coverEditorWrap{
  position:absolute;
  inset:0;
  display:none;
  align-items:center;
  justify-content:center;
  padding-top:70px;
  box-sizing:border-box;
}

#coverCanvas {
  width: 815px;
  height: 532px;

  position: relative;
  overflow: hidden;

  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.08);
}




.templates-grid.cover-mode{
  grid-template-columns: 1fr;
}

@media (min-width: 769px) {
  .templates-grid.cover-mode
  .template-card {
    width: 100% !important;
    height: auto !important;

    aspect-ratio:
      815 / 532 !important;

    min-width: 0 !important;
    min-height: 0 !important;
  }
}



.cover-sidebar-item{
  width:100%;
  margin-bottom:22px;
  cursor:pointer;
}

.cover-sidebar-preview{
  display:flex;
  width:100%;
  aspect-ratio: 2 / 1.35;
  border:2px solid transparent;
  overflow:hidden;
  box-sizing:border-box;
}

.cover-sidebar-item.active .cover-sidebar-preview{
  border-color:#FF5181;
}

.cover-sidebar-half{
  width:50%;
  height:100%;
  position:relative;
}

.cover-sidebar-front{
  background:#cfcfcf;
}

.cover-sidebar-labels{
  display:flex;
  width:100%;
  margin-top:6px;
  font-size:12px;
  color:#666;
}

.cover-sidebar-labels span{
  width:50%;
  text-align:center;
}

.cover-sidebar-preview-real{
  width:190px;
  height:119px;
  position:relative;
  overflow:hidden;
  border:2px solid #FF5181;
  box-sizing:border-box;
  background:#f5c4d3;
}


.cover-template-card {
  position: relative;

  width: 100% !important;
  height: auto !important;

  aspect-ratio:
    815 / 532 !important;

  min-width: 0 !important;
  min-height: 0 !important;

  overflow: hidden;

  background: #f5c4d3;

  border:
    2px solid #e5e5e5;

  border-radius: 12px;

  box-sizing: border-box;
}

.cover-template-card.active{
  border-color:#FF5181;
}



    
    .export-page {
  width: 1800px !important;
  height: 2030px !important;
  background: #fff;
  position: relative;
  overflow: hidden;
  border: none !important;
  flex: 0 0 1800px;
}

.export-page .page-slot {
  border: none !important;
}

.export-page .add-photo {
  display: none !important;
}

.text-box {
  position:absolute;
  /*min-width:120px;
  min-height:30px;*/
  cursor:move;
  font-size:22px;
  color:black;
  font-family:Arial;
  z-index:50;
  user-select:none;
  white-space:nowrap;
  will-change: transform;
}
.text-box.selected {
  box-shadow: 0 0 0 1px #FF5181;
  border-radius: 6px;
}
.delete-selected-btn {
  display: none;
}

.messenger-modal {

  position: fixed;
  inset: 0;

  background: rgba(0,0,0,.35);

  z-index: 99999;

  display: none;

  align-items: center;
  justify-content: center;
}

.messenger-modal.open {
  display: flex;
}

.messenger-box {

  position: relative;

  width: min(
    420px,
    calc(100vw - 30px)
  );

  background: white;

  border-radius: 24px;

  padding: 20px;

  box-sizing: border-box;
}

.messenger-close-icon {

  position: absolute;

  top: 14px;
  right: 14px;

  width: 34px;
  height: 34px;

  border: none;

  background: transparent;

  color: #999;

  font-size: 20px;

  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;
}

.messenger-close-icon:hover {
  color: #222;
}



.messenger-title {

  font-size: 22px;
  font-weight: 600;

  margin-bottom: 8px;

  text-align: center;
}

.messenger-subtitle {

  font-size: 15px;

  color: #666;

  text-align: center;

  margin-bottom: 14px;
}

.messenger-copy-btn,
.messenger-close-btn {

  width: 100%;

  height: 48px;

  border: none;

  border-radius: 16px;

  cursor: pointer;
}

.messenger-copy-btn {

  width: 100%;

  height: 48px;

  border: none;

  border-radius: 16px;

  cursor: pointer;

  background: #FF5181;

  color: white;

  margin-bottom: 12px;

  font-size: 15px;

  font-weight: 600;
}

.messenger-close-btn {

  background: #e9e9e9;
}

.messenger-buttons {

  display: flex;

  gap: 8px;

  margin-bottom: 12px;
}

.messenger-buttons a {

  flex: 1;

  height: 46px;

  background: #f5f5f5;

  border-radius: 16px;

  display: flex;

  align-items: center;
  justify-content: center;

  text-decoration: none;

  color: #222;
}

.messenger-email-btn {

  width: 100%;

  height: 48px;

  margin-bottom: 12px;

  border-radius: 16px;

  background: #f5f5f5;

  color: #222;

  text-decoration: none;

  display: flex;

  align-items: center;
  justify-content: center;

  font-size: 17px;

  font-weight: 500;
}

.cover-color-btn {
  height: 38px;
  padding: 0 16px;
  border-radius: 10px;
  background: #f1f1f1;
  color: #222;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  white-space: nowrap;
}

.cover-color-btn input {
  width: 28px;
  height: 28px;
  border: none;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.desktop-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}





.add-book-btn{
  width:100%;
  height:78px;
  margin:20px 0 34px;
  padding:0 18px;

  display:flex;
  align-items:center;
  gap:14px;

  background:#f7f7f7;
  border-radius:22px;
  box-sizing:border-box;
  text-decoration:none;
  overflow:hidden;
}

.add-book-btn img{
  width:48px;
  height:48px;
  border-radius:10px;
  object-fit:cover;
  background:#fff;
}

.add-book-info{
  flex:1;
  text-align:left;
  min-width:0;
}

.add-book-info span{
  display:block;
  font-size:18px;
  line-height:1.15;
  font-weight:700;
  color:#111;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.add-book-info strong{
  display:block;
  margin-top:5px;
  font-size:18px;
  font-weight:800;
  color:#ff477b;
}

.add-book-plus{
  width:42px;
  height:42px;
  border-radius:50%;
  background:#ff477b;
  color:#fff;

  display:flex;
  align-items:center;
  justify-content:center;

  font-size:28px;
  line-height:1;
  font-weight:700;
  flex-shrink:0;
}







































#editorLoader {
  position: fixed;
  inset: 0;
  background: #f6f1ec;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Arial, sans-serif;
  color: #111;
}

.loaderBox {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  transform: translateY(-20px);
}

.loaderLogo {
  width: 72px;
  height: 72px;
  border-radius: 24px;

  background: #FF5181;
  color: white;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 38px;
  font-weight: 800;
  font-family: "Alegreya Sans SC", Arial, sans-serif;

  margin-bottom: 22px;

  box-shadow: 0 18px 40px rgba(255, 81, 129, 0.25);
}

.loaderSpinner {
  width: 38px;
  height: 38px;
  border-radius: 50%;

  border: 4px solid rgba(255, 81, 129, 0.18);
  border-top-color: #FF5181;

  animation: loaderSpin 0.8s linear infinite;

  margin-bottom: 22px;
}

.loaderTitle {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
}

.loaderText {
  font-size: 15px;
  color: #777;
}

#editorLoader.hidden {
  display: none;
}

@keyframes loaderSpin {
  to {
    transform: rotate(360deg);
  }
}

/* ===== MODAL: MAKET READY FINAL ===== */

/* Checkout modal */

.checkout-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;

  display: none;
  align-items: center;
  justify-content: center;

  background: rgba(0, 0, 0, 0.35);
font-family: Arial, sans-serif;
  
}

.checkout-modal.open {
  display: flex;
}

.checkout-modal__box {
  position: relative;

  width: 420px;
  max-width: calc(100vw - 40px);

  background: #ffffff;

  border-radius: 34px;

  padding: 28px;

  box-sizing: border-box;
}

.checkout-modal__close {
  position: absolute;
  top: 8px;
  right: 18px;

  width: 15px;
  height: 15px;

  border: none;
  background: transparent;

  color: #999;

  font-size: 15px;
  line-height: 15px;

  padding: 0;
  cursor: pointer;
}

.checkout-modal__title {
  text-align: center;

  font-size: 28px;
  line-height: 1.1;
  font-weight: 800;

  color: #000;

  margin-bottom: 32px;
}

.checkout-modal__text {
  text-align: center;

  font-size: 16px;
  line-height: 1.16;
  font-weight: 400;

  color: #666;

  margin-bottom: 20px;
}

.checkout-modal__id-row {
  position: relative;

  width: 100%;

  margin-bottom: 16px;
}

.checkout-modal__id-input {
  width: 100%;
  height: 58px;

  
  border: 1px solid #d8d8d8;
  border-radius: 20px;

  padding: 0 92px 0 28px;

  box-sizing: border-box;

  background: #fff;
  color: #000;

  font-size: 18px;
  font-weight: 500;

  outline: none;
}

.checkout-modal__copy {
  position: absolute;
  top: 50%;
  right: 16px;

  transform: translateY(-50%);

  width: 32px;
  height: 32px;

  border: none;
  background: transparent;

  color: #999;
  font-size: 24px;
  font-weight: 400;

  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;
}

.checkout-modal__order-btn {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 100%;
  height: 58px;

  border-radius: 20px;

  background: #ff4f83;
  color: #fff;

  text-decoration: none;

  font-size: 20px;
  font-weight: 500;
}

.checkout-modal__problem {
  margin-top: 24px;
  margin-bottom: 16px;

  text-align: center;

  font-size: 16px;
  line-height: 1.2;

  color: #666;
}

.checkout-modal__mail-btn {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 100%;
  height: 58px;

  border-radius: 20px;

  background: #f5f5f5;
  color: #111;

  text-decoration: none;

  font-size: 18px;
  font-weight: 500;
}









.cover-icon-mini-panel {
  position: absolute;
  transform: translateX(-50%);
  z-index: 99999;

  display: flex;
  gap: 4px;

  padding: 4px;

  background: #fff;
  border-radius: 999px;

  box-shadow: 0 6px 18px rgba(0,0,0,.16);
  pointer-events: auto;
}

.cover-icon-panel-btn {
  width: 24px;
  height: 24px;

  border: none;
  border-radius: 50%;

  background: #FF5181;
  color: white;

  font-size: 15px;
  line-height: 1;

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;
}







@media (max-width: 768px) {
  .checkout-modal__box {
    width: calc(100vw - 28px);

    padding: 38px 22px 32px;

    border-radius: 28px;
  }

  .checkout-modal__close {
    top: 18px;
    right: 18px;

    width: 36px;
    height: 36px;

    font-size: 34px;
  }

  .checkout-modal__title {
    font-size: 34px;
    margin-bottom: 26px;
  }

  .checkout-modal__text {
    font-size: 24px;
    margin-bottom: 32px;
  }

  .checkout-modal__id-input {
    height: 76px;

    border-radius: 18px;

    padding-left: 18px;
    padding-right: 66px;

    font-size: 23px;
  }

  .checkout-modal__copy {
    right: 16px;

    width: 42px;
    height: 42px;

    font-size: 32px;
  }

  .checkout-modal__order-btn {
    height: 76px;

    border-radius: 18px;

    font-size: 28px;
  }

  .checkout-modal__problem {
    margin-top: 58px;
    margin-bottom: 20px;

    font-size: 24px;
  }

  .checkout-modal__mail-btn {
    height: 70px;

    border-radius: 18px;

    font-size: 25px;
  }
}





@media(max-width: 768px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    margin: 0;
    overflow-x: hidden;
    background: #f5f5f5;
  }

  .desktop-toolbar {
    display: none !important;
  }







.upload-toast {
  position: fixed;
  top: 30px;

  width: 130px;
  height: 40px;

  right: 20px;
  bottom: 20px;

  padding: 12px;

  background: rgba(255,255,255,0.95);

  border-radius: 14px;

  box-sizing: border-box;
}

  .upload-toast-title {
    font-size: 11px;
    margin-bottom: 4px;
    line-height: 1;
  }

  .upload-toast-bar {
    height: 3px;
  }




  .editor-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 0 12px;
  }

  .editor-logo {
    font-size: 13px;
    max-width: 95px;
    line-height: 1.1;
  }

  .editor-project-name {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    margin-top: 0;

    font-size: 13px;
    max-width: 120px;
    text-align: center;
    display: none;
  }

  .editor-header-actions {
    gap: 10px;
  }

  .header-btn {
    font-size: 10px;
    gap: 2px;
  }

  .header-btn svg {
    width: 20px;
    height: 20px;
  }





#photoBookApp {
  width: 100vw;
  max-width: 100vw;

  height: 100dvh;
  min-height: 0;

  display: grid;
  grid-template-columns: 1fr;

  background: #f5f5f5;

  overflow: hidden;

  box-sizing: border-box;
}

 .center-panel {
  width: 100vw;
  max-width: 100vw;

  min-height: 0;
  height: 100%;

  padding: 100px 0 170px;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;

  overflow-x: hidden;
  overflow-y: auto;

  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;

  box-sizing: border-box;
}

  .top-actions {
    position: fixed !important;
    top: 58px !important;
    left: 12px !important;
    right: 12px !important;

    z-index: 1300 !important;

    display: flex;
    align-items: center;
    justify-content: flex-end;

    pointer-events: none;
  }

  .export-toolbar {
    width: 100% !important;

    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;

    gap: 8px !important;

    pointer-events: auto;
  }

  .export-toolbar button:first-child {
    display: none !important;
  }

  .export-toolbar button:last-child {
    margin-left: auto !important;
  }

  .export-toolbar .save-btn {
    height: 44px;
    padding: 0 20px;

    border-radius: 14px;

    font-size: 14px;
    font-weight: 500;

    flex: 0 0 auto;
  }

  .export-toolbar .history-btn {
    width: 44px;
    height: 44px;

    flex: 0 0 44px;

    padding: 0;

    border-radius: 12px;
    background: #dedede;
  }

  .export-toolbar .history-btn svg {
    width: 22px;
    height: 22px;
    stroke: #ababab;
  }

  .book-spread {
    width: calc(100vw - 32px);
    max-width: calc(100vw - 32px);

    margin: 0 auto;

    display: flex;
    flex-shrink: 0;

    overflow: hidden;
    box-sizing: border-box;
  }

  .page {
    width: 50%;
    height: calc(((100vw - 32px) / 2) * 1.127);

    box-sizing: border-box;
  }

  .page-numbers {
    width: calc(100vw - 32px);
    max-width: calc(100vw - 32px);

    display: flex;
    justify-content: space-between;

    gap: 0;

    margin: 10px auto 12px;

    flex-shrink: 0;
    box-sizing: border-box;
  }

  .page-number {
    width: 34px;
    height: 34px;

    font-size: 12px;
  }

  .add-photo {
    width: 38px;
    height: 38px;

    font-size: 26px;
  }

  .left-panel {
    position: fixed;

    left: 10px;
    right: 10px;
    bottom: 86px;

    height: 130px;

    z-index: 110000000000;

    display: none;

    padding: 10px;

    overflow-x: auto;
    overflow-y: hidden;

    background: #fff;

    border-radius: 22px;

    box-shadow: 0 8px 24px rgba(0,0,0,.16);

    box-sizing: border-box;
  }

  .left-panel.open {
    display: block;
  }

  .templates-title,
  .templates-switch,
  #selectedCoverBox {
    display: none !important;
  }

  .templates-grid {
    display: flex;
    gap: 10px;

    width: max-content;
  }

  .template-card {
    width: 82px;
    height: 105px;

    flex: 0 0 auto;
  }

  #coverSidebar,
  #pagesSidebar {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: flex-start !important;

    gap: 10px !important;

    width: max-content !important;
    min-width: max-content !important;

    flex: 0 0 auto !important;
  }

  .thumb-spread,
  .thumb-item,
  .cover-sidebar-item {
    flex: 0 0 auto !important;
  }

  .thumb-item {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .thumb-spread {
    margin-bottom: 0;
  }

  .thumb-page {
    width: 42px !important;
    height: 58px !important;
  }

  .thumb-label {
    display: block;

    min-width: 90px;

    margin: 4px 0 0;

    font-size: 10px;
    color: #777;
    text-align: center;
  }

.mobile-bottom-menu {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: 1px;

  transform: translateX(-50%);

  width: calc(100vw - 42px);
  max-width: 300px;
  height: 65px;

  z-index: 1200;

  display: flex;
  align-items: center;
  justify-content: space-around;

  padding: 0 12px;
  box-sizing: border-box;

  background: rgba(255, 255, 255, 0.32);

  backdrop-filter: blur(26px) saturate(180%);
  -webkit-backdrop-filter: blur(26px) saturate(180%);

  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 26px;

  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.7),
    0 10px 28px rgba(0,0,0,.08);
}

.mobile-nav-btn {
  position: relative;

  flex: 1;
  height: 52px;

  border: none;
  background: transparent;

  color: #111;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  gap: 3px;

  border-radius: 999px;

  font-size: 10px;
  font-weight: 600;
  line-height: 1;

  transition: .25s;
}

.mobile-nav-btn::before {
  content: "";

  position: absolute;
  inset: 2px;

  border-radius: 999px;

  background: rgba(255,81,129,.12);

  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);

  border: 1px solid rgba(255,255,255,.35);

  opacity: 0;
  transition: .25s;
}

.mobile-nav-btn img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

.mobile-nav-btn.active::before {
  opacity: 1;
  background: rgba(255, 164, 190, 0.16);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.55),
    0 6px 18px rgba(255,81,129,.16);
}

.mobile-nav-btn.active span {
    filter:
    brightness(0)
    saturate(100%)
    invert(47%)
    sepia(91%)
    saturate(1513%)
    hue-rotate(305deg)
    brightness(103%)
    contrast(101%);
}

.mobile-nav-btn.active img {
  filter:
    brightness(0)
    saturate(100%)
    invert(47%)
    sepia(91%)
    saturate(1513%)
    hue-rotate(305deg)
    brightness(103%)
    contrast(101%);
}

.mobile-nav-btn img,
.mobile-nav-btn span {
  position: relative;
  z-index: 2;
}

  .center-panel.cover-mode {
  width: 100vw !important;
  max-width: 100vw !important;

  min-height: calc(100vh - 74px) !important;
  height: auto !important;

padding: 130px 0 95px !important;

  justify-content: flex-start !important;

  overflow-x: hidden !important;
  overflow-y: visible !important;
}

  .center-panel.cover-mode #coverEditorWrap {
    display: flex !important;
  }

  #coverEditorWrap {
  position: relative !important;
  inset: auto !important;

  width: 100vw !important;
  max-width: 100vw !important;

  height: 240px !important;

  display: none;

  align-items: flex-start !important;
  justify-content: center !important;

  padding: 0 !important;

  overflow: visible !important;

  box-sizing: border-box !important;
}

  #coverCanvas {
    position: absolute !important;

    left: 50% !important;
    top: 0 !important;

    width: 815px !important;
   height: 532px !important;

    transform: translateX(-50%) scale(0.46) !important;
    transform-origin: top center !important;

    max-width: none !important;

    overflow: hidden !important;

    margin: 0 !important;
  }

  .cover-sidebar-labels {
    font-size: 6px;
    margin-top: 4px;
  }

  .cover-sidebar-labels span {
    width: 46px;
    text-align: center;
  }

  .cover-sidebar-preview-real {
    width: 92px !important;
    height: 58px !important;

    overflow: hidden !important;

    position: relative;
  }

  .cover-sidebar-preview-real > * {
    width: 815px !important;
    height: 532px !important;

    transform: scale(0.111);
    transform-origin: top left;
  }

  #fontSizeInputMobile,
  #fontSelectMobile,
  #textColorSelectMobile {
    font-size: 16px;
  }

  .cover-icon-mini-panel {
    gap: 8px;
    padding: 7px;
  }

  .cover-icon-panel-btn {
    width: 60px;
    height: 60px;
    font-size: 40px;
  }
}


/* =========================
   MOBILE PHOTO PROJECT FLOW
========================= */

#mobileProjectFlow {
  display: none;
}

@media (max-width: 768px) {

  .center-panel.mobile-flow-mode {
    padding-top: 80px !important;
  }

  .center-panel.mobile-flow-mode
  > .book-spread,

  .center-panel.mobile-flow-mode
  > #coverEditorWrap,

  .center-panel.mobile-flow-mode
  > .page-numbers,

  .center-panel.mobile-flow-mode
  > #desktopPhotoFramesGrid {
    display: none !important;
  }

  .center-panel.mobile-flow-mode
  #mobileProjectFlow {
    width: 100%;

    display: block;

    padding:
      0
      16px
      120px;

    box-sizing: border-box;
  }

  /*
   * Общие заголовки:
   * «Коробка» и «Снимки».
   */
  .mobile-photo-section-title {
    width: 100%;

    margin: 0;

    font-size: 16px;
    font-weight: 600;
    line-height: 1.15;

    color: #111111;
    text-align: center;

    box-sizing: border-box;
  }

  /*
   * Блок коробки.
   */
  .mobile-flow-cover-card {
    width: 100%;

    margin: 0 0 64px;
  }

  .mobile-flow-cover-card
  .mobile-photo-section-title {
    margin-bottom: 30px;
  }

  .mobile-flow-cover-frame {
    position: relative;

    width: 100%;
  aspect-ratio: 815 / 532;

    overflow: hidden;

    background: transparent;

    /*
     * Никакого выделения обложки.
     */
    border: none;
    outline: none;
    box-shadow: none;
  }

  .mobile-flow-cover-frame.active {
    border: none;
    outline: none;
    box-shadow: none;
  }

  .mobile-flow-cover-inner {
    position: absolute;

    top: 0;
    left: 0;
  }


  /*
   * Две рамки в строке.
   */
  .mobile-photo-frames-grid {
    width: 100%;

    display: grid;
    grid-template-columns:
      repeat(2, minmax(0, 1fr));

    column-gap: 18px;
    row-gap: 38px;

    align-items: start;

    box-sizing: border-box;
  }

  .mobile-photo-frame-card {
    width: 100%;
    min-width: 0;

    display: flex;
    flex-direction: column;
    align-items: stretch;

    box-sizing: border-box;
  }

  /*
   * Перебиваем старое правило,
   * где у мобильной .page стояло
   * width: 50% и фиксированная высота.
   */
  #mobileProjectFlow
  .mobile-photo-frame.page {
    position: relative;

    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;

    flex: none !important;

    background: #ffffff;

    border: 1px solid #d7d7d7;
    outline: none !important;
    box-shadow: none !important;

    box-sizing: border-box;
    overflow: hidden;
  }

  /*
   * Активная рамка выглядит
   * точно так же, как неактивная.
   */
  #mobileProjectFlow
  .mobile-photo-frame.page.active {
    border: 1px solid #d7d7d7 !important;
    outline: none !important;
    box-shadow: none !important;
  }

  /*
   * Строка номера под рамкой.
   */
  .mobile-photo-frame-number-row {
    position: relative;

    width: 100%;

    display: flex;
    justify-content: center;

    margin: 12px 0 0;

    box-sizing: border-box;
  }

  /*
   * Обычный номер без кнопочного фона,
   * рамки и розовой подсветки.
   */
  .mobile-photo-frame-number,
  .mobile-photo-frame-number.active {
    position: relative;

    width: 100%;
    height: 22px;

    padding: 0;
    margin: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border: none !important;
    border-radius: 0;

    background: transparent !important;

    color: #555555 !important;

    font-size: 15px;
    font-weight: 400;
    line-height: 1;

    box-shadow: none !important;
  }

  /*
   * Заголовок коробки тоже
   * не меняет цвет при выборе.
   */
  .mobile-cover-number,
  .mobile-cover-number.active {
    background: transparent !important;
    color: #111111 !important;
    border: none !important;
    box-shadow: none !important;
  }
}







.photo-editor-modal {
  position: fixed;
  inset: 0;
  z-index: 100000000000000;

  display: none;
  align-items: center;
  justify-content: center;

  background: rgba(0, 0, 0, 0.55);
  overscroll-behavior: contain;
}

.photo-editor-modal.open {
  display: flex;
}

.photo-editor-modal__box {
  position: relative;
  z-index: 1;

  width: 600px;
  height: 900px;

  background: #2f2f2f;
  border-radius: 22px;
  overflow: hidden;

  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

.photo-editor-modal__close {
  position: absolute;
  top: 22px;
  left: 22px;
  z-index: 20;

  border: none;
  background: transparent;
  padding: 0;

  color: #fff;
  cursor: pointer;
}

.photo-editor-modal__close svg {
  width: 22px;
  height: 22px;
}

.photo-editor-modal__done {
  position: absolute;
  top: 24px;
  right: 28px;
  z-index: 20;
}

.photo-editor-modal__done svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.photo-editor-modal__photo-wrap {
  position: relative;

  width: 100%;
  height: 100%;

  padding: 0;
  box-sizing: border-box;

  overflow: hidden;
  touch-action: none;
}

.photo-editor-modal__image {
  position: absolute;

  left: 0;
  top: 0;

  width: 100%;
  height: 100%;

  object-fit: cover;

  user-select: none;
  -webkit-user-drag: none;
  touch-action: none;

  cursor: grab;
  transform-origin: center center;

  z-index: 1;
}


.photo-editor-shade {
  position: absolute;
  z-index: 9;

  pointer-events: none;

  border: 9999px solid rgba(0, 0, 0, 0.75);
  box-sizing: content-box;
}

.photo-editor-toolbar {
  position: absolute;
  z-index: 20;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;

  color: #fff;
}




.photo-editor-top-btn {
  display: flex;
  align-items: center;
  gap: 10px;

  border: none;
  background: transparent;

  padding: 0;

  color: #fff;

  font-family: Arial, sans-serif;
  font-size: 15px;
  font-weight: 500;
  line-height: 1;

  cursor: pointer;

  transition: opacity .15s;
}

.photo-editor-top-btn:hover {
  opacity: .75;
}

.photo-editor-top-btn img {
  width: 18px;
  height: 18px;

  flex-shrink: 0;

  display: block;

  pointer-events: none;
}



.photo-editor-dots {
  display: flex;
  align-items: center;
  gap: 10px;
}

.photo-editor-dots span {
  width: 2px;
  height: 2px;

  border-radius: 50%;
  background: rgba(255,255,255,.55);
}

.photo-editor-dots span.active {
  width: 5px;
  height: 5px;

  background: #fff;
}

.photo-editor-bottom-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.photo-editor-bottom-btn {
  height: 38px;

  padding: 0 18px;

  border: none;
  border-radius: 999px;

  background: transparent;
  color: #fff;

  font-family: Arial, sans-serif;
  font-size: 16px;
  font-weight: 500;

  cursor: pointer;
}

.photo-editor-bottom-btn.active {
  background: rgba(255,255,255,.18);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
  backdrop-filter: blur(10px);
}






.photo-editor-bottom-panel {
  position: absolute;
  z-index: 20;

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 25px;

  color: #fff;
  font-family: Arial, sans-serif;

  pointer-events: auto;
}


.photo-editor-footer {
  position: absolute;
  left: 50%;

  transform: translateX(-50%);

  z-index: 20;

  display: flex;
  align-items: center;
  gap: 46px;
}

.photo-editor-footer-btn {
  display: flex;
  align-items: center;
  gap: 8px;

  border: none;
  background: transparent;

  padding: 0;

  color: #fff;

  font-family: Arial, sans-serif;
  font-size: 16px;
  font-weight: 500;

  cursor: pointer;

  opacity: .9;
  transition: opacity .15s;
}

.photo-editor-footer-btn:hover {
  opacity: 1;
}

.photo-editor-footer-btn img {
  width: 18px;
  height: 18px;

  display: block;
  flex-shrink: 0;
}


.photo-editor-footer {
  position: absolute;
  left: 50%;
  bottom: 22px;

  transform: translateX(-50%);

  z-index: 20;

  display: flex;
  align-items: center;
  gap: 46px;

  padding-top: 16px;
}

.photo-editor-footer::before {
  content: "";

  position: absolute;

  left: -120px;
  right: -120px;
  top: 0;

  height: 1px;

  background: rgba(255,255,255,.08);
}


.photo-editor-frame {
  position: absolute;
  z-index: 10;

  border: 0.5px solid #ffffff;
  box-sizing: border-box;

  pointer-events: auto;
  overflow: hidden;
  cursor: grab;
  touch-action: none;

  box-shadow: 0 0 0 9999px rgba(0,0,0,.75);
}

#photoEditorImage {
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
}


@media (max-width: 768px) {

  
  .photo-editor-modal {
    align-items: stretch;
    justify-content: stretch;
  }

  .photo-editor-modal__box {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
  }

  .photo-editor-header {
    top: 18px;
    left: 18px;
    right: 18px;
    grid-template-columns: 34px 1fr auto;
  }

  .photo-editor-header-actions {
    gap: 18px;
  }

  .photo-editor-footer-btn {
    font-size: 13px;
    gap: 5px;
  }

  .photo-editor-footer-btn img {
    width: 15px;
    height: 15px;
  }

.photo-editor-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-left: auto;
  margin-right: auto;
}

  .photo-editor-bottom-btn {
    height: 42px;
    padding: 0 24px;
    font-size: 16px;
  }
}





@media(max-width: 768px) {

  
  .mobile-flow-cover-card {
    width: 100%;
  }

  .mobile-flow-title {
    margin-bottom: 10px;
    font-size: 15px;
    font-weight: 600;
    color: #222;
  }

.mobile-flow-cover-frame {
  position: relative;
  width: 100%;
aspect-ratio: 815 / 532;
  overflow: hidden;
}

.mobile-flow-cover-inner {
  position: absolute;
  left: 0;
  top: 0;
}



  #mobileFlowCoverCanvas {
    box-shadow: none !important;
    margin: 0 !important;
  }



.cover-mobile-editor-modal {
  position: fixed;
  inset: 0;
  z-index: 999999999;

  display: none;
  align-items: center;
  justify-content: center;

  background: rgba(0, 0, 0, 0.55);
  overscroll-behavior: contain;
}

.cover-mobile-editor-modal.open {
  display: flex;
}

.cover-mobile-editor-box {
  position: relative;

  width: 100vw;
  height: 100dvh;

  background: #2f2f2f;
  overflow: hidden;
}

.cover-mobile-editor-close {
  position: absolute;
  top: 20px;
  left: 22px;
  z-index: 30;

  border: none;
  background: transparent;
  color: #fff;

  font-size: 34px;
  line-height: 1;
}

.cover-mobile-editor-done {
  position: absolute;
  top: 24px;
  right: 28px;
  z-index: 30;
}

.cover-mobile-editor-stage {
  position: absolute;
  inset: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 0 0 120px 0;
  box-sizing: border-box;

  overflow: hidden;
}

.cover-mobile-editor-stage #coverCanvas {
  transform-origin: center center !important;
  margin: 0 !important;
  flex-shrink: 0 !important;
}

body.cover-editor-mobile-open {
  position: fixed !important;
  overflow: hidden !important;
  width: 100% !important;
  left: 0 !important;
  right: 0 !important;
}

.cover-mobile-editor-bottom-panel {
  position: absolute;
  left: 50%;
  bottom: 28px;

  transform: translateX(-50%);

  z-index: 30;

  display: flex;
  align-items: center;
  gap: 14px;

  padding: 10px 14px;

  border-radius: 999px;
  background: rgba(255,255,255,.12);
  backdrop-filter: blur(14px);
}

.cover-mobile-editor-bottom-panel input[type="color"] {
  width: 28px;
  height: 28px;
  margin-left: 8px;
  padding: 0;
  border: none;
  background: transparent;
}

.mobile-cover-preview,
.mobile-cover-preview * {
  pointer-events: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

.cover-mobile-editor-stage {
  position: absolute;
  inset: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  padding-bottom: 120px;
  box-sizing: border-box;
}

#coverEditorWrap.inside-mobile-cover-modal {
  position: relative !important;
  inset: auto !important;

  width: auto !important;
  max-width: none !important;
  height: auto !important;

  display: flex !important;
  align-items: center !important;
  justify-content: center !important;

  padding: 0 !important;
  overflow: visible !important;
}

#coverEditorWrap.inside-mobile-cover-modal #coverCanvas {
  position: relative !important;
  left: auto !important;
  top: auto !important;

  width: 815px !important;
  height: 532px !important;

  transform: scale(0.43) !important;
  transform-origin: center center !important;

  max-width: none !important;
  margin: 0 !important;

  box-shadow: 0 0 0 9999px rgba(0,0,0,.35);
}

}

@media (max-width: 768px) {

.mobile-cover-dock {
    position: absolute;
    left: 50%;
    bottom: 10px;
    transform: translateX(-50%);

    width: calc(100vw - 28px);
    max-width: 430px;
    height: 66px;

    display: flex;
    align-items: center;
    justify-content: space-around;

    padding: 8px 12px;
    box-sizing: border-box;

    background: #fff;          /* ← белый фон */
    border-radius: 22px;

    border: 1px solid #ececec;

    box-shadow:
      0 12px 30px rgba(0,0,0,.12),
      0 2px 6px rgba(0,0,0,.06);

    z-index: 99999;
}

  .cover-dock-btn {
    width: 58px;
    height: 58px;

    border: none;
    background: transparent;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;

    color: #111;
    cursor: pointer;

    border-radius: 999px;
    -webkit-tap-highlight-color: transparent;
  }


  .cover-dock-btn {
    width: 58px;
    height: 58px;

    border: none;
    background: transparent;

    display: flex;
    flex-direction: column;
    align-items: center;

   justify-content: center;
gap: 3px;
padding: 0;
    box-sizing: border-box;

    border-radius: 999px;
    cursor: pointer;
}

.cover-dock-btn img {
    width: 26px;
    height: 26px;

    object-fit: contain;
    flex-shrink: 0;
}

.cover-dock-btn span {
    font-size: 9px;
    font-weight: 600;
    color: #666;

    line-height: 1;
    white-space: nowrap;

    margin-top: 0;
}


  .cover-dock-btn:active {
    background: rgba(0, 0, 0, 0.08);
    transform: scale(0.94);
  }

  .cover-dock-btn.danger {
    color: #ff2b55;
  }


}

@media (max-width: 768px) {
.mobile-cover-text-panel,
.mobile-page-text-panel {
    position: fixed;

    left: 50%;
    bottom: 85px;

    transform: translateX(-50%) translateY(0);

    width: calc(100vw - 28px);
    max-width: 430px;
    height: 64px;

    display: flex;
    align-items: center;
    gap: 8px;

    padding: 10px 12px;
    box-sizing: border-box;

    background: #fff;
    border-radius: 22px;
    border: 1px solid #ececec;

    box-shadow:
      0 12px 30px rgba(0,0,0,.12),
      0 2px 6px rgba(0,0,0,.06);

    z-index: 1000000002;

    opacity: 0;
    pointer-events: none;

    transition: .18s ease;
}

.mobile-cover-text-panel.open,
.mobile-page-text-panel.open {
    opacity:1;
    pointer-events:auto;
    transform:translateX(-50%) translateY(0);
}

.mobile-cover-text-panel select,
.mobile-page-text-panel select,
.mobile-cover-text-panel input[type="number"],
.mobile-page-text-panel input[type="number"] {
    height: 42px;
    border: none;
    border-radius: 14px;
    background: #f3f3f3;
    font-size: 14px;
    padding: 0 10px;
    box-sizing: border-box;
  }

.mobile-cover-text-panel select,
.mobile-page-text-panel select {
    flex: 1;
    min-width: 0;
  }

  .mobile-cover-text-panel input[type="number"] {
    width: 54px;
    text-align: center;
  }

.cover-text-small-btn,
.cover-text-size-value {
  color: #000;
  -webkit-text-fill-color: #000;
}

  .cover-text-small-btn {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 14px;
    background: #f3f3f3;
    font-size: 22px;
  }

  .cover-text-color-input {
    width: 42px;
    height: 42px;
    border: none;
    padding: 4px;
    border-radius: 14px;
    background: #f3f3f3;
  }
}

.cover-text-small-btn {
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#coverTextSizeMobilePanel {
  font-size: 16px !important;
  touch-action: manipulation;
}


.cover-mobile-editor-modal.keyboard-open #mobileCoverEditDock {
  display: none !important;
}

.cover-mobile-editor-modal.keyboard-open .mobile-cover-text-panel {
  position: fixed !important;
  left: 34px !important;
  right: 34px !important;
  bottom: 8px !important;
  z-index: 1000000000002 !important;
  transform: none !important;
}

.cover-text-size-modal {
  position: fixed;
  inset: 0;

  display: none;
  align-items: center;
  justify-content: center;

  background: rgba(0,0,0,.35);

  z-index: 1000000000005;
}

.cover-text-size-modal.open {
  display: flex;
}

.cover-text-size-modal-box {
  width: 280px;
  max-width: calc(100vw - 40px);

  background: #fff;
  border-radius: 24px;

  padding: 22px;

  box-sizing: border-box;
  text-align: center;
}

.cover-text-size-modal-title {
  font-size: 20px;
  font-weight: 700;

  margin-bottom: 16px;
}

.cover-text-size-modal-input {
  width: 100%;
  height: 54px;

  border: 1px solid #e3e3e3;
  border-radius: 16px;

  padding: 0 14px;

  box-sizing: border-box;

  font-size: 22px;
  font-weight: 600;

  text-align: center;
  outline: none;
}

.cover-text-size-modal-save {
  width: 100%;
  height: 52px;

  margin-top: 16px;

  border: none;
  border-radius: 16px;

  background: #ff5181;
  color: #fff;

  font-size: 17px;
  font-weight: 600;
}

.cover-text-size-value {
  width: 54px;
  height: 42px;
  border: none;
  border-radius: 14px;
  background: #f3f3f3;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
}

.cover-text-add-btn,
.cover-text-small-btn,
.cover-text-size-value {
  width: 38px;
  height: 38px;

  flex: 0 0 38px;

  border: none;
  border-radius: 12px;

  background: #f3f3f3;

  display: flex;
  align-items: center;
  justify-content: center;

  color: #000;
  -webkit-text-fill-color: #000;

  font-size: 17px;
  font-weight: 600;

  appearance: none;
  -webkit-appearance: none;
}

.cover-text-add-btn img {
  width: 22px;
  height: 22px;
  display: block;
}

.cover-text-size-value {
  min-width: 42px;
  padding: 0 6px;
}

#pageTextFontMobilePanel {
  min-width: 0;
  flex: 1;
}

#pageTextSizeMobilePanel {
  font-size: 16px !important;
  touch-action: manipulation;
}

#coverTextFontMobilePanel {
  min-width: 0;
  flex: 1;
}
#mobileCoverBackgroundPanel {
  gap: 10px;
  overflow: hidden;
}

#mobileCoverBackgroundPanel .cover-bg-presets {
  display: flex;
  align-items: center;
  gap: 8px;

  width: 100%;
  min-width: 0;

  overflow-x: auto;
  overflow-y: hidden;

  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
}


#mobileCoverBackgroundPanel .cover-bg-presets button,
#mobileCoverBackgroundPanel .cover-bg-picker-btn {
  width: 32px;
  height: 32px;
  min-width: 32px;
  flex: 0 0 32px;

  border-radius: 50%;
  border: 2px solid rgba(0,0,0,.14);
  padding: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  box-sizing: border-box;
}



#coverBackgroundPickerBtn {
  background: conic-gradient(
    #ff4f81,
    #ffd84f,
    #5fe17b,
    #4fb6ff,
    #9d6bff,
    #ff4f81
  );
}

.cover-bg-picker-btn {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.cover-bg-picker-btn img {
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.cover-bg-picker-btn input {
  position: absolute;
  inset: 0;

  width: 100%;
  height: 100%;

  opacity: 0;
  cursor: pointer;
}

#mobileCoverIconsPanel {
    height: 130px;
    padding: 10px 12px;
}

.cover-icons-grid {
    display: flex;
    align-items: center;
    gap: 10px;
    

    overflow-x: auto;
    overflow-y: hidden;

    width: 100%;
    height: 100%;

    -webkit-overflow-scrolling: touch;
}

.cover-icons-grid::-webkit-scrollbar {
    display: none;
}

.cover-icon-item {
  width: 115px;
  height: 115px;
  flex: 0 0 115px;

  padding: 0;
  border: none;
  border-radius: 22px;
  background: #f3f3f3;

  display: flex;
  align-items: center;
  justify-content: center;

  overflow: hidden;
  cursor: pointer;
}

.cover-icon-upload-item {
  background: #f3f3f3;
}

.cover-icon-upload-plus {
  width: 54px;
  height: 54px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 50%;

  background: rgba(255, 255, 255, 0.92);
  color: #111;

  font-size: 38px;
  line-height: 1;
  font-weight: 400;

  pointer-events: none;
}

.cover-icon-item img {
  width: 110px;
  height: 110px;
  object-fit: contain;
  display: block;
}

.cover-icon-item:active {
    transform: scale(.92);
}

.cover-icon-item.active {
  box-shadow: 0 0 0 3px #FF5181 inset;
}


.mobile-header-actions {
  display: none;
}

@media(max-width: 768px) {
.editor-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;

    height: 60px;

    padding: 0 10px;

    background: #fff;

    z-index: 1000;
}

.mobile-header{
    width:100%;
    display:flex;
    align-items:center;
    gap:12px;
}

.mobile-back-btn{
    width:42px;
    height:42px;
    margin-left: -8px;

    border:none;
    background:none;
    padding:0;

    display:flex;
    align-items:center;
    justify-content:center;
}

.mobile-back-btn img{
    width:28px;
    height:28px;
}

.mobile-header-center{
    flex:1;
    min-width:0;

    display:flex;
    flex-direction:column;
    justify-content:center;
    
    
}

.mobile-header-center .editor-project-name{
    position:static !important;
    transform:none !important;

    display:block !important;

    margin-left: -8px;

    max-width:none;

    text-align:left;

    font-size:16px;
    font-weight:500;

    color:#111;
}

.mobile-header-rename{
    margin-top:2px;

    padding:0;

    border:none;
    background:none;

    text-align:left;
    margin-left: -8px;

    font-size:11px;

    color:#b6b6b6;
}

.mobile-projects-btn{
    width:40px;

    border:none;
    background:none;

    display:flex;
    flex-direction:column;
    align-items:center;

    gap:2px;
}

.mobile-projects-btn img{
    width:25px;
}

.mobile-projects-btn span{
    font-size:11px;
    color:#ff5181;
}

.mobile-order-btn{
    width:130px;
    height:44px;
    border:none;
    border-radius:22px;

    background:#ff5181;
    color:#fff;

    font-size:16px;
    font-weight:500;
}


  .editor-logo,
  .editor-header-actions,
  .editor-project-name {
    display: none !important;
  }

  .mobile-header-actions {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .mobile-header-icon-btn {
    width: 44px;
    height: 44px;

    border: none;
    border-radius: 16px;

    background: rgba(255,255,255,.55);
    color: #111;

    font-size: 30px;
    line-height: 1;

    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  .mobile-header-make-btn {
    flex: 1;
    height: 44px;

    border: none;
    border-radius: 16px;

    background: #FF5181;
    color: #fff;

    font-size: 15px;
    font-weight: 600;
  }

  .top-actions {
    display: none !important;
  }



.mobile-flow-numbers .page-number {
  position: relative;
}



.spine-modal-box {
    transform: translateY(-120px);
  }

  .spine-modal,
.spine-modal * {
  touch-action: manipulation;
}
.spine-modal-save,
.spine-modal-cancel {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

}

/* ===== СКРЫВАЕМ МОБИЛЬНЫЕ ЭЛЕМЕНТЫ НА ПК ===== */
@media (min-width: 769px) {
  .mobile-bottom-menu,
  .mobile-header-actions,
  #mobileCoverTextPanel,
  #mobilePageTextPanel,
  #mobileCoverBackgroundPanel,
  #mobileCoverIconsPanel,
  #mobileCoverEditDock,
  #coverTextSizeModal {
    display: none !important;
  }
}


.rename-project-modal {
  position: fixed;
  inset: 0;

  display: none;
  align-items: center;
  justify-content: center;

  padding: 20px;
  box-sizing: border-box;

  background: rgba(0, 0, 0, 0.35);

  z-index: 1000000000;
}

.rename-project-modal.open {
  display: flex;
}

.rename-project-modal__box {
  width: 100%;
  max-width: 380px;

  padding: 24px;

  background: #fff;
  border-radius: 24px;

  box-sizing: border-box;

  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.2);
}

.rename-project-modal__title {
  margin-bottom: 18px;

  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;

  color: #111;
  text-align: center;
}

.rename-project-modal__input {
  width: 100%;
  height: 52px;

  padding: 0 16px;

  border: 1px solid #dedede;
  border-radius: 16px;

  background: #f7f7f7;
  color: #111;

  font-size: 16px;

  outline: none;
  box-sizing: border-box;
}

.rename-project-modal__input:focus {
  border-color: #ff5181;
  background: #fff;
}

.rename-project-modal__actions {
  display: flex;
  gap: 10px;

  margin-top: 18px;
}

.rename-project-modal__actions button {
  flex: 1;
  height: 48px;

  border: none;
  border-radius: 16px;

  font-size: 15px;
  font-weight: 600;

  cursor: pointer;
}

.rename-project-modal__cancel {
  background: #f1f1f1;
  color: #333;
}

.rename-project-modal__save {
  background: #ff5181;
  color: #fff;
}

.mobile-pages-manager {
  display: none;
}

@media (max-width: 768px) {
  .rename-project-modal {
    align-items: flex-end;
    padding: 12px;
  }

  .rename-project-modal__box {
    max-width: none;

    padding: 22px 18px calc(22px + env(safe-area-inset-bottom));

    border-radius: 26px;
  }

  .rename-project-modal__title {
    font-size: 19px;
  }

  .rename-project-modal__input {
    font-size: 16px;
  }

.mobile-pages-manager-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));

  gap: 30px 18px;

  width: 100%;
  padding: 8px 0 0;

  box-sizing: border-box;
}

.mobile-manager-spread {
  min-width: 0;
}

.mobile-manager-spread-pages {
  position: relative;

  display: flex;

  width: 100%;
  aspect-ratio: 2 / 1.127;

  overflow: hidden;


  background: #fff;
  border: 1px solid #d8d8d8;

  box-sizing: border-box;
}

.mobile-manager-page-preview {
  position: relative;

  width: 50%;
  height: 100%;

  overflow: hidden;

  background: #fff;

  box-sizing: border-box;
}

.mobile-manager-page-preview:first-child {
  border-right: 1px solid #d8d8d8;
}

.mobile-manager-page-preview-empty {
  background: #f2f2f2;
}

.mobile-manager-page-preview .page {
  position: absolute !important;

  left: 0 !important;
  top: 0 !important;

  transform-origin: top left !important;

  pointer-events: none !important;
}



.mobile-manager-page-numbers {
  display: grid;
  grid-template-columns: 1fr 1fr;

  width: 100%;

  margin-top: 8px;

  font-size: 13px;
  line-height: 1;
  color: #555;

  text-align: center;
}

.mobile-pages-manager.open {
  display: block;
  width: 100%;

  padding:
    0
    16px
    calc(82px + env(safe-area-inset-bottom));

  box-sizing: border-box;
}

body.mobile-pages-manager-open #mobileProjectFlow {
  display: none !important;
}


.mobile-pages-manager {
  display: none;
}

.mobile-manager-spread-center {
  position: absolute;

  left: 50%;
  top: 0;

  transform: translateX(-50%);

  width: 34px;
  height: 100%;

  background: transparent;

  cursor: grab;
  z-index: 20;

  touch-action: pan-y;
}

.mobile-manager-spread-center:active {
  cursor: grabbing;
}

.mobile-pages-manager,
.mobile-pages-manager * {
  -webkit-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
}

.mobile-manager-spread-pages {
  touch-action: pan-y;
}

.mobile-manager-page-preview {
  touch-action: pan-y;
  cursor: grab;
}

/* Всё содержимое отрисованной страницы не принимает нажатия */
.mobile-manager-page-preview .page,
.mobile-manager-page-preview .page * {
  pointer-events: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  -webkit-touch-callout: none !important;
}


/* Невидимая центральная зона остаётся активной */
.mobile-manager-spread-center {
  pointer-events: auto !important;
  touch-action: pan-y;
  user-select: none !important;
  -webkit-user-select: none !important;
  -webkit-touch-callout: none !important;
}


.mobile-manager-page-preview.drag-active::after,
.mobile-manager-page-preview.drag-target::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
  box-sizing: border-box;
  border: 1px solid #FF5181;
}

.mobile-manager-spread-pages.drag-active::after,
.mobile-manager-spread-pages.drag-target::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
  box-sizing: border-box;
  border: 1px solid #FF5181;
}

.mobile-manager-page-preview.drag-active,
.mobile-manager-spread-pages.drag-active {
  opacity: 0.78;
}


.mobile-manager-drag-ghost {
  position: fixed;
  left: 0;
  top: 0;

  z-index: 999999;

  pointer-events: none;

  opacity: 0.92;

  transform: translate(-50%, -50%) scale(1.03);

  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);

  background: #fff;
}

.mobile-manager-drag-ghost.page-ghost {
  overflow: hidden;
}

.mobile-manager-drag-ghost.spread-ghost {
  overflow: hidden;
}

.mobile-manager-page-insert-line {
  position: fixed;

  width: 3px;
  height: 120px;

  z-index: 999998;
  pointer-events: none;

  border-radius: 999px;

  background:
    repeating-linear-gradient(
      to bottom,
      #FF5181 0,
      #FF5181 2px,
      transparent 9px,
      transparent 15px
    );

  transform: translate(-50%, -50%);

  display: none;
}

.mobile-manager-page-insert-line.show {
  display: block;
}

.mobile-manager-page-preview {
  transition:
    transform 0.18s ease,
    box-shadow 0.15s ease,
    opacity 0.15s ease;
}

.mobile-manager-page-preview.insert-shift-left {
  transform: translateX(-10px);
}

.mobile-manager-page-preview.insert-shift-right {
  transform: translateX(10px);
}

.mobile-manager-spread-insert-line {
  position: fixed;
  z-index: 999999;
  pointer-events: none;

  width: 3px;

  border-radius: 999px;

  background: repeating-linear-gradient(
    to bottom,
    #ff5181 0,
    #ff5181 2px,
    transparent 5px,
    transparent 10px
  );

  transform: translate(-50%, -50%);

  display: none;
}



.mobile-manager-spread-insert-line.show {
  display: block;
}

.mobile-manager-spread {
  transition: transform 0.18s ease;
}

.mobile-manager-spread.insert-shift-left {
  transform: translateX(-10px);
}

.mobile-manager-spread.insert-shift-right {
  transform: translateX(10px);
}

}

@media (max-width: 768px) {

  body.mobile-pages-manager-open .center-panel {
    min-height: 0 !important;

    padding-top: 90px !important;

    padding-bottom:
      calc(78px + env(safe-area-inset-bottom))
      !important;
  }

  body.mobile-pages-manager-open .mobile-pages-manager.open {
    padding:
      0
      16px
      0
      !important;
  }

  body.mobile-pages-manager-open .mobile-pages-manager-list {
    padding:
      8px
      0
      0
      !important;
  }

body:not(.mobile-pages-manager-open)
.center-panel.mobile-flow-mode {
  min-height: 0 !important;

  padding-top: 80px !important;

  padding-bottom:
    calc(78px + env(safe-area-inset-bottom))
    !important;
}

  body:not(.mobile-pages-manager-open)
  .center-panel.mobile-flow-mode
  #mobileProjectFlow {
    padding:
      0
      16px
      0
      !important;
  }

  html.mobile-manager-dragging,
html.mobile-manager-dragging body {
  overscroll-behavior: none;
}
}


/* ========================================
   DESKTOP HEADER
======================================== */

@media (min-width: 769px) {

  .editor-header {
    position: relative;

    width: 100%;
    height: 55px;

    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;

    padding: 0 24px;
    box-sizing: border-box;

    background: #ffffff;
    border-bottom: 1px solid #ececec;

    z-index: 1000;
  }


  /* Логотип слева */

  .editor-logo {
    justify-self: start;

    margin: 0;

    font-family: "Montserrat", Arial, sans-serif;
    font-size: 20px;
    line-height: 1;
    font-weight: 500;

    color: #ff5181;
    text-decoration: none;
    white-space: nowrap;
  }


  /* Название проекта по центру */

  .desktop-header-project {
    justify-self: center;

    min-width: 0;
    max-width: 420px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    text-align: center;
  }

  .desktop-header-project-name {
    max-width: 420px;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    font-family: "Montserrat", Arial, sans-serif;
    font-size: 16px;
    line-height: 20px;
    font-weight: 500;

    color: #222222;
  }


  /* Переименовать */

  .desktop-header-rename {
    margin-top: 3px;
    padding: 0;

    border: none;
    background: transparent;

    font-family: "Montserrat", Arial, sans-serif;
    font-size: 11px;
    line-height: 14px;
    font-weight: 400;

    color: #aaaaaa;

    cursor: pointer;
    transition:
      color 0.15s ease,
      opacity 0.15s ease;
  }

  .desktop-header-rename:hover {
    color: #ff5181;
  }


  /* Правая часть */

  .editor-header-actions {
    justify-self: end;

    display: flex;
    align-items: center;
    gap: 10px;
  }


  /* Проекты */

  .desktop-projects-btn {
    height: 42px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    padding: 0 16px;

    border: 1px solid #e8e8e8;
    border-radius: 14px;

    background: #ffffff;
    color: #333333;

    font-family: "Montserrat", Arial, sans-serif;
    font-size: 14px;
    font-weight: 500;

    cursor: pointer;

    transition:
      background 0.15s ease,
      border-color 0.15s ease,
      transform 0.15s ease;
  }

  .desktop-projects-btn img {
    width: 20px;
    height: 20px;

    display: block;
    object-fit: contain;
  }

  .desktop-projects-btn:hover {
    background: #fafafa;
    border-color: #dddddd;
  }

  .desktop-projects-btn:active {
    transform: scale(0.97);
  }


  /* Оформить */

  .desktop-order-btn {
    min-width: 130px;
    height: 42px;

    padding: 0 22px;

    border: none;
    border-radius: 14px;

    background: #ff5181;
    color: #ffffff;

    font-family: "Montserrat", Arial, sans-serif;
    font-size: 14px;
    font-weight: 500;

    cursor: pointer;

    box-shadow: 0 6px 16px rgba(255, 81, 129, 0.2);

    transition:
      background 0.15s ease,
      transform 0.15s ease,
      box-shadow 0.15s ease;
  }

  .desktop-order-btn:hover {
    background: #f74878;
    box-shadow: 0 8px 20px rgba(255, 81, 129, 0.26);
  }

  .desktop-order-btn:active {
    transform: scale(0.97);
  }


  /* Мобильная шапка на ПК скрыта */

  .mobile-header {
    display: none !important;
  }
}


@media (max-width: 768px) {
  .desktop-header-project {
    display: none !important;
  }
}

@media (min-width: 769px) {
  #mobilePageTextPanel.mobile-page-text-panel {
    position: fixed;

    left: 50%;
    bottom: 28px;

    transform:
      translateX(-50%)
      translateY(15px);

    width: auto;
    min-width: 430px;
    max-width: calc(100vw - 40px);
    height: 64px;

    padding: 10px 12px;
    box-sizing: border-box;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    background: rgba(255, 255, 255, 0.96);

    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);

    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 22px;

    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.14);

    z-index: 100000;

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transition:
      opacity 0.18s ease,
      transform 0.18s ease,
      visibility 0.18s ease;
  }

  #mobilePageTextPanel.mobile-page-text-panel.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;

    transform:
      translateX(-50%)
      translateY(0);
  }
}

.desktop-center-tools {
  position: absolute;

  top: 0;
  left: 50%;
  transform: translateX(-50%);

  display: flex;
  align-items: center;
  gap: 12px;
}



.desktop-page-text-panel {
  display: flex;
  align-items: center;
  gap: 8px;

  height: 54px;
  padding: 5px 10px;

  background: #fff;
  border-radius: 18px;

  box-sizing: border-box;

  box-shadow:
    0 5px 18px rgba(0, 0, 0, 0.08);
}

.desktop-element-actions-panel {
  position: absolute;

  top: 0;
  right: 0;

  display: none;
  align-items: center;
  gap: 8px;

  height: 54px;
  padding: 5px 10px;

  background: #fff;
  border-radius: 18px;

  box-sizing: border-box;

  box-shadow:
    0 5px 18px rgba(0, 0, 0, 0.08);
}

@media (min-width: 769px) {
  .center-panel.cover-mode .desktop-element-actions-panel {
    display: flex;
  }
}

.desktop-cover-color-control {
  height: 42px;
  padding: 0 10px;

  display: inline-flex;
  align-items: center;
  gap: 8px;

  background: #f5f5f5;
  border-radius: 13px;

  font-size: 14px;
  color: #222;

  cursor: pointer;
  box-sizing: border-box;
}

.desktop-cover-color-control input {
  width: 30px;
  height: 30px;

  padding: 0;
  border: 0;
  background: transparent;

  cursor: pointer;
}

.delete-selected-btn {
  display: none;
}

.desktop-delete-element-btn {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;

  padding: 0;
  border: 0;
  background: transparent;

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: default;

  transition:
    transform 0.15s ease,
    opacity 0.15s ease;
}

.desktop-delete-element-btn img {
  width: 28px;
  height: 28px;
  display: block;
}

.desktop-delete-element-btn:not(:disabled) {
  cursor: pointer;
}

.desktop-delete-element-btn:not(:disabled):hover {
  transform: scale(1.06);
}

.desktop-center-tools {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);

  display: flex;
  align-items: center;
  gap: 12px;
}

/* ===== ПК: ВЫБОР ШРИФТА ===== */

@media (min-width: 769px) {

  #desktopPageTextFontPanel {
    width: 210px;
    height: 40px;
    flex: 0 0 210px;

    padding: 0 38px 0 16px;

    border: 0;
    border-radius: 13px;

    background-color: #f3f3f3;

    font-family: Arial, sans-serif;
    font-size: 16px;
    font-weight: 400;
    color: #222;

    outline: none;
    cursor: pointer;

    box-sizing: border-box;
  }

}

/* ===== ПК: ЦВЕТ ТЕКСТА ===== */

@media (min-width: 769px) {

  #desktopPageTextColorPanel {
    appearance: none;
    -webkit-appearance: none;

    width: 42px;
    height: 42px;
    flex: 0 0 42px;

    padding: 6px;

    border: 0;
    border-radius: 13px;

    background: #f3f3f3;

    box-sizing: border-box;
    cursor: pointer;
  }

  #desktopPageTextColorPanel::-webkit-color-swatch-wrapper {
    padding: 0;
  }

  #desktopPageTextColorPanel::-webkit-color-swatch {
    border: 0;
    border-radius: 9px;
  }

  #desktopPageTextColorPanel::-moz-color-swatch {
    border: 0;
    border-radius: 9px;
  }

}

@media (min-width: 769px) {
  .desktop-element-actions-panel:empty {
    display: none;
  }

  .desktop-element-actions-panel.hidden {
    display: none;
  }
}

/* ===== ПК: НАЗАД / ВПЕРЁД ===== */

@media (min-width: 769px) {

  .desktop-history-actions {
    position: absolute;
    top: 0;
    left: 0;

    display: flex;
    align-items: center;
    gap: 10px;
  }

  .desktop-history-btn {
    width: 42px;
    height: 42px;

    padding: 0;
    border: 0;
    background: transparent;

    display: flex;
    align-items: center;
    justify-content: center;

    cursor: default;

    transition:
      transform 0.15s ease,
      opacity 0.15s ease;
  }

  .desktop-history-btn img {
    width: 30px;
    height: 30px;
    display: block;
  }

  .desktop-history-btn:not(:disabled) {
    cursor: pointer;
  }

  .desktop-history-btn:not(:disabled):hover {
    transform: scale(1.06);
  }

}

.desktop-cover-icons-panel {
  position: fixed;
  z-index: 10000;

  display: none;

  width: 370px;
  max-height: min(520px, calc(100vh - 30px));

  padding: 16px;

  background: #fff;
  border-radius: 20px;

  box-shadow:
    0 18px 60px rgba(0, 0, 0, 0.16);

  overflow-y: auto;
}

.desktop-cover-icons-panel.open {
  display: block;
}

.desktop-cover-icons-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;

  margin-bottom: 14px;

  font-size: 15px;
  font-weight: 600;
}

.desktop-cover-icons-panel__close {
  width: 30px;
  height: 30px;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 0;
  border: 0;
  border-radius: 50%;

  background: #f2f2f2;

  font-size: 21px;
  line-height: 1;
  cursor: pointer;
}

.desktop-cover-icons-panel .cover-icons-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

@media (max-width: 768px) {
  .desktop-cover-icons-panel {
    display: none !important;
  }
}


.desktop-support-panel{
  position:fixed;
  z-index:10000;

  display:none;

  width:340px;

  background:#fff;

  border-radius:20px;

  padding:15px;

  box-shadow:0 18px 60px rgba(0,0,0,.16);
}

.desktop-support-panel.open{
  display:block;
}

.desktop-support-panel__header{
  display:flex;
  justify-content:space-between;
  align-items:center;

  margin-bottom:20px;

  font-size:18px;
  font-weight:600;
}

.desktop-support-panel__close{
  width:30px;
  height:30px;

  border:none;
  border-radius:50%;

  background:#f3f3f3;

  cursor:pointer;
}

.desktop-support-id-title{
  font-size:13px;
  color:#888;

  margin-bottom:6px;
}

.desktop-support-id{
  font-size:17px;
  font-weight:600;

  margin-bottom:22px;
}

.desktop-support-btn{
  width:100%;
  height:48px;

  border:none;
  border-radius:14px;

  background:#FF5181;
  color:#fff;

  cursor:pointer;

  font-size:15px;
  font-weight:600;

  margin-bottom:10px;
}

.desktop-support-btn--secondary{
  background:#f3f3f3;
  color:#222;
}

.desktop-support-panel__header {
  position: relative;

  min-height: 30px;
  margin-bottom: 18px;

  display: flex;
  align-items: center;
}

.desktop-support-panel__title {
  font-family: inherit;
  font-size: 18px;
  font-weight: 600;
}

.desktop-support-panel__close {
  position: absolute;
  top: -7px;
  right: -7px;

  width: 30px;
  height: 30px;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 0;
  border: 0;
  border-radius: 50%;

  background: #f2f2f2;
  color: #777;

  font-family: Arial, sans-serif;
  font-size: 21px;
  line-height: 1;

  cursor: pointer;
}

.desktop-support-id-field {
    width: 100%;
    height: 48px;

    display: flex;
    align-items: center;

    margin-bottom: 12px;

    background: #f3f3f3;
    border-radius: 14px;

    overflow: hidden;
}

.desktop-support-id {
    flex: 1;

    display: flex;
    align-items: center;
    justify-content: center;

    height: 100%;

    margin: 0;
    padding: 0;

    font-size: 16px;
    font-weight: 500;
    line-height: 1;

    color: #4A4A4A;
}

.desktop-support-copy-btn {
    width: 48px;
    height: 100%;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 0;
    border-left: 1px solid rgba(0,0,0,.06);

    background: transparent;
    color: #777;

    cursor: pointer;
    transition: .2s;
}

.desktop-support-copy-btn:hover {
    background: #ececec;
    color: #FF5181;
}

.desktop-support-panel {
  font-family: Arial, sans-serif;
}

@media (min-width: 769px) {
    .editor-logo,
    .desktop-header-project,
    .editor-header-actions {
        transform: translateY(-5px);
    }
}

@media (min-width: 769px) {

  .sidebar-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;

    width: 100%;
    margin-bottom: 20px;
  }

  .sidebar-tab {
    height: 48px;

    border: none;
    border-radius: 16px;

    background: #f1f1f1;
    color: #222;

    font-family: "Montserrat", Arial, sans-serif;
    font-size: 15px;
    font-weight: 500;

    cursor: pointer;
  }

  .sidebar-tab.active {
    background: #ff5181;
    color: #fff;
  }

  .sidebar-tab-content {
    display: none;
  }

  .sidebar-tab-content.active {
    display: block;
  }
}



@media (max-width: 768px) {

  .mobile-gallery-page {
    display: none;

    position: fixed;
    top: 62px; /* высота верхнего мобильного хедера */
    right: 0;
    bottom: calc(70px + env(safe-area-inset-bottom));
    left: 0;

    z-index: 50;

    padding: 0 16px;
    box-sizing: border-box;

    background: #f5f5f5;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .mobile-gallery-page.open {
    display: flex;
    flex-direction: column;
  }

  .mobile-gallery-header {
    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: space-between;

    width: 100%;
    min-height: 52px;

    margin: 0;
    padding: 0;

    box-sizing: border-box;
  }

  .mobile-gallery-grid {
    flex: 1;

    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-content: start;

    gap: 5px;
    width: 100%;
  }

  .mobile-gallery-empty {
    grid-column: 1 / -1;

    align-self: stretch;

    min-height: 100%;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    padding: 0 20px;
    box-sizing: border-box;

    text-align: center;
  }

.mobile-gallery-title {
  font-family: Arial, sans-serif;
  font-size: 22px;
  line-height: 1;
  font-weight: 600;

  color: #111;
}

.mobile-gallery-count {
  font-family: Arial, sans-serif;
  font-size: 13px;
  line-height: 1;

  color: #999;
}

.mobile-gallery-grid {
  display: grid;
  grid-template-columns:
    repeat(3, minmax(0, 1fr));

  gap: 5px;

  width: 100%;
}

.mobile-gallery-item {
  position: relative;

  width: 100%;
  aspect-ratio: 1 / 1;

  padding: 0;
  border: 0;
  border-radius: 8px;

  background: #e5e5e5;

  overflow: hidden;
  cursor: pointer;
}

.mobile-gallery-item img {
  width: 100%;
  height: 100%;

  display: block;
  object-fit: cover;

  -webkit-user-drag: none;
  user-select: none;
}

.mobile-gallery-item__status {
  position: absolute;
  inset: auto 5px 5px 5px;

  padding: 4px 5px;

  border-radius: 7px;

  background: rgba(0, 0, 0, 0.6);
  color: #fff;

  font-family: Arial, sans-serif;
  font-size: 9px;
  line-height: 1;

  text-align: center;
}

.mobile-gallery-item.error::after {
  content: "Ошибка";

  position: absolute;
  inset: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(255, 255, 255, 0.75);
  color: #d94444;

  font-family: Arial, sans-serif;
  font-size: 11px;
}





.mobile-gallery-empty {
    
  grid-column: 1 / -1;
  display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    min-height: calc(100vh - 180px);

    text-align: center;
}

.mobile-gallery-empty__title {
  margin-bottom: 8px;

  font-family: Arial, sans-serif;
  font-size: 17px;
  font-weight: 600;

  color: #222;
}

.mobile-gallery-empty__text {
  font-family: Arial, sans-serif;
  font-size: 13px;
  line-height: 1.4;

  color: #999;
}

}

@media (min-width: 769px) {

  .desktop-gallery-grid {
    width: 100%;

    display: grid;
    grid-template-columns:
      repeat(3, minmax(0, 1fr));

    gap: 8px;

    align-content: start;
    box-sizing: border-box;
  }


  .desktop-gallery-item {
    position: relative;

    width: 100%;
    aspect-ratio: 1 / 1;

    padding: 0;
    border: 0;
    border-radius: 10px;

    background: #eeeeee;

    overflow: hidden;
    cursor: pointer;
  }

  .desktop-gallery-item img {
    width: 100%;
    height: 100%;

    display: block;
    object-fit: cover;

    user-select: none;
    -webkit-user-drag: none;

    transition: transform 0.2s ease;
  }

  .desktop-gallery-item:hover img {
    transform: scale(1.04);
  }

  .desktop-gallery-item__status {
    position: absolute;
    left: 6px;
    right: 6px;
    bottom: 6px;

    padding: 5px 6px;

    border-radius: 7px;

    background: rgba(0, 0, 0, 0.62);
    color: #ffffff;

    font-family: Arial, sans-serif;
    font-size: 10px;
    line-height: 1;

    text-align: center;
  }

  .desktop-gallery-item.error::after {
    content: "Ошибка загрузки";

    position: absolute;
    inset: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 10px;

    background: rgba(255, 255, 255, 0.82);
    color: #d94444;

    font-family: Arial, sans-serif;
    font-size: 11px;
    line-height: 1.3;
    text-align: center;
  }

  .desktop-gallery-empty {
    grid-column: 1 / -1;

    padding: 50px 10px;

    text-align: center;
  }

  .desktop-gallery-empty__title {
    margin-bottom: 7px;

    font-family: Arial, sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: #222222;
  }

  .desktop-gallery-empty__text {
    font-family: Arial, sans-serif;
    font-size: 12px;
    line-height: 1.4;
    color: #999999;
  }
}


@media (min-width: 769px) {
  #mobileGalleryPage {
    display: none !important;
  }
}

.desktop-gallery-header__right,
.mobile-gallery-header__right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.desktop-gallery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;

  margin-bottom: 16px;
}

.desktop-gallery-count {
  font-family: "Montserrat", sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #8d8d8d;
}

.desktop-gallery-add-btn,
.mobile-gallery-add-btn {
  width: 34px;
  height: 34px;

  padding: 0;
  border: 0;
  border-radius: 50%;

  display: flex;
  align-items: center;
  justify-content: center;

  background: #ff5181;
  color: #ffffff;

  font-family: Arial, sans-serif;
  font-size: 25px;
  font-weight: 400;
  line-height: 1;

  cursor: pointer;
}

.desktop-gallery-add-btn:hover {
  opacity: 0.85;
}

.gallery-empty-add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  margin-top: 24px;

  width: 100%;
  max-width: 280px;
  height: 50px;

  padding: 0 22px;

  border: none;
  border-radius: 16px;

  background: #ff5181;
  color: #ffffff;

  font-family: "Montserrat", sans-serif;
  font-size: 15px;
  font-weight: 500;

  cursor: pointer;

  transition:
    background .2s ease,
    transform .15s ease;
}

.gallery-empty-add-btn:hover {
  background: #f44577;
}

.gallery-empty-add-btn:active {
  transform: scale(.98);
}

@media (min-width: 769px) {
  .desktop-gallery-item {
    cursor: grab;
  }

  .desktop-gallery-item:active {
    cursor: grabbing;
  }

  .desktop-gallery-item.dragging {
    opacity: 0.45;
  }

  .page-slot.gallery-drop-target {
    outline: 3px solid #ff5181 !important;
    outline-offset: -3px;
    background: rgba(255, 81, 129, 0.12) !important;
  }
}

@media (max-width: 768px) {
  
.mobile-gallery-item {
  touch-action: pan-y;
  -webkit-touch-callout: none;
  user-select: none;
}

body.mobile-gallery-photo-dragging
.mobile-gallery-item {
  touch-action: none;
}

  .mobile-gallery-item.mobile-dragging {
    opacity: 0.45;
    transform: scale(0.94);
    outline: 3px solid #ff5181;
    outline-offset: 2px;
  }

  .mobile-gallery-drag-clone {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 30000;

    width: 88px;
    height: 88px;

    border-radius: 14px;
    overflow: hidden;

    pointer-events: none;

    box-shadow:
      0 12px 34px rgba(0, 0, 0, 0.28);

    transform:
      translate3d(0, 0, 0)
      translate(-50%, -50%);

    will-change: transform;
  }

  .mobile-gallery-drag-clone img {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: cover;
  }

body.mobile-gallery-photo-dragging {
  overflow: hidden;
  touch-action: none;
}
}

.mobile-gallery-page,
.mobile-gallery-page * {
  -webkit-user-select: none;
  user-select: none;

  -webkit-touch-callout: none;

  -webkit-tap-highlight-color: transparent;
}

.mobile-gallery-item,
.mobile-gallery-item img {
  touch-action: pan-y;
  -webkit-user-drag: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.gallery-empty-add-btn,
.mobile-gallery-add-btn {
  -webkit-user-select: none;
  user-select: none;
}

@media (max-width: 768px) {
  .mobile-gallery-page {
    transition: transform 0.22s ease;
    will-change: transform;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  }

.mobile-gallery-page.mobile-gallery-drag-to-flow {
  opacity: 0;

  /*
   * Не отключаем pointer-events:
   * Safari должен продолжать отправлять
   * события захваченному элементу.
   *
   * Саму галерею уводим за экран,
   * чтобы она не перекрывала развороты.
   */
  pointer-events: auto;

  transform:
    translateX(-110vw)
    !important;

  transition: none !important;
}

  body.mobile-gallery-drag-over-flow
  #mobileProjectFlow {
    display: flex !important;
    position: relative;
    z-index: 10;
  }

  body.mobile-gallery-drag-over-flow
  .mobile-gallery-drag-clone {
    visibility: visible;
    opacity: 1;
    z-index: 40000;
  }

  .mobile-gallery-page.drag-locked {
    overflow: hidden !important;
    overscroll-behavior: none;
    touch-action: none;
  }

  .mobile-gallery-page.drag-locked,
  .mobile-gallery-page.drag-locked * {
    touch-action: none !important;
  }


  #mobileProjectFlow
  .page-slot.mobile-gallery-drop-target {
    position: absolute;
    z-index: 9999 !important;
  }

  #mobileProjectFlow
  .page-slot.mobile-gallery-drop-target::after {
    content: "";

    position: absolute;
    inset: 0;

    box-sizing: border-box;

    border: 4px solid #ff5181;
    border-radius: inherit;

    pointer-events: none;

    z-index: 2147483647;
  }

  /*
    Всё содержимое слота находится
    ниже рамки.
  */
  #mobileProjectFlow
  .page-slot.mobile-gallery-drop-target > img,
  #mobileProjectFlow
  .page-slot.mobile-gallery-drop-target > .add-photo,
  #mobileProjectFlow
  .page-slot.mobile-gallery-drop-target > .photo-loading {
    z-index: 1 !important;
  }

  /*
    На мобильном скрываем ПК-переключатель
    «Галерея / Шаблоны».
  */
  .left-panel .sidebar-tabs {
    display: none !important;
  }

  /*
    Галерею внутри левой панели
    на мобильном не показываем.
  */
  .left-panel #desktopGalleryContent {
    display: none !important;
  }

  /*
    Показываем только шаблоны.
  */
  .left-panel #desktopTemplatesContent {
    display: block !important;
    width: 100%;
  }

  /*
    Заголовок «Шаблоны страниц»
    раньше на мобильном был скрыт.
  */
  .left-panel #templatesTitle {
    display: none !important;
  }

  body:not(.cover-editor-mobile-open)
  .left-panel.open {
    bottom:
      calc(
        85px + env(safe-area-inset-bottom)
      ) !important;
  }


body.cover-editor-mobile-open
.left-panel {
  display: none !important;
}

body.cover-editor-mobile-open
.left-panel.open {
  position: fixed !important;

  display: block !important;

  left: 14px !important;
  right: 14px !important;
  bottom: 85px !important;

  width: auto !important;
  height: 130px !important;

  padding: 10px !important;

  overflow-x: auto !important;
  overflow-y: hidden !important;

  background: #ffffff !important;
  border-radius: 22px !important;

  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;

  z-index: 1000000002 !important;
}

body.cover-editor-mobile-open
.left-panel.open
#desktopTemplatesContent {
  display: block !important;
  width: 100% !important;
}

body.cover-editor-mobile-open
.left-panel.open
#desktopGalleryContent {
  display: none !important;
}

body.cover-editor-mobile-open
.left-panel.open
.templates-grid {
  display: flex !important;
  width: max-content !important;
  gap: 10px !important;
}

}

@media (min-width: 769px) {
  .left-panel {
    
    position: relative;

    display: flex;
    flex-direction: column;

    padding-bottom: 84px;
    box-sizing: border-box;
  }
}



@media (max-width: 768px) {
  body.mobile-gallery-open {
    position: fixed;
    width: 100%;
    overflow: hidden !important;
  }

  .mobile-gallery-page {
    overflow-y: auto !important;
    overflow-x: hidden !important;

    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
  }

  .mobile-gallery-grid {
    overflow: visible !important;
  }
}

@media (min-width: 769px) {
  .cover-mobile-editor-close {
    display: none !important;
  }
}

.support-copy-success {
  background: #39b96b !important;
  color: #fff !important;

  transform: scale(.94);

  transition:
    background .2s ease,
    transform .18s ease;
}

@media (min-width: 769px) {
  /*
    Внутренняя постоянная обводка
    превью обложки всегда выключена.
  */
  #coverSidebar .cover-sidebar-preview-real {
    border-color: transparent !important;
    outline: none !important;
  }

  /*
    Когда редактор обложки закрыт,
    внешняя обводка тоже отсутствует.
  */
  #coverSidebar:not(.cover-editor-active)
  .cover-sidebar-item.active
  .cover-sidebar-preview {
    border-color: transparent !important;
    outline: none !important;
    box-shadow: none !important;
  }

  /*
    Когда редактор обложки открыт,
    подсвечивается только активная обложка.
  */
  #coverSidebar.cover-editor-active
  .cover-sidebar-item.active
  .cover-sidebar-preview {
    border-color: #ff5181 !important;
  }
}

.desktop-bottom-menu {
  display: none;
}

@media (min-width: 769px) {
  .center-panel {
    position: relative;
  }

  .desktop-bottom-menu {
    position: fixed;

    left: 50%;
    bottom: clamp(
    16px,
    3vh,
    32px
  );

    transform: translateX(-50%);

    width: 360px;
    height: 66px;

    z-index: 50;

    display: flex;
    align-items: center;
    justify-content: space-around;

    padding: 0 12px;

    box-sizing: border-box;

    background:
      rgba(255, 255, 255, 0.42);

    backdrop-filter:
      blur(26px)
      saturate(180%);

    -webkit-backdrop-filter:
      blur(26px)
      saturate(180%);

    border:
      1px solid
      rgba(255, 255, 255, 0.62);

    border-radius: 26px;

    box-shadow:
      inset 0 1px 0
        rgba(255, 255, 255, 0.78),
      0 10px 28px
        rgba(0, 0, 0, 0.08);
  }
}

@media (min-width: 769px) {
  .desktop-bottom-nav-btn {
    position: relative;

    flex: 1;
    height: 52px;

    padding: 0;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: 4px;

    border: none;
    border-radius: 999px;

    background: transparent;

    color: #222;

    font-family:
      "Montserrat",
      Arial,
      sans-serif;

    font-size: 10px;
    font-weight: 600;
    line-height: 1;

    cursor: pointer;

    transition:
      transform 0.2s ease;
  }

  .desktop-bottom-nav-btn img {
    width: 23px;
    height: 23px;

    display: block;
    object-fit: contain;
  }

  .desktop-bottom-nav-btn img,
  .desktop-bottom-nav-btn span {
    position: relative;
    z-index: 2;
  }

  .desktop-bottom-nav-btn:hover {
    transform: translateY(-1px);
  }

  .desktop-bottom-nav-btn:active {
    transform: scale(0.96);
  }
}

@media (min-width: 769px) {
  .desktop-bottom-nav-btn::before {
    content: "";

    position: absolute;

    inset: 2px;

    border-radius: 999px;

    background:
      rgba(255, 164, 190, 0.16);

    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);

    border:
      1px solid
      rgba(255, 255, 255, 0.35);

    box-shadow:
      inset 0 1px 0
        rgba(255, 255, 255, 0.55),
      0 6px 18px
        rgba(255, 81, 129, 0.16);

    opacity: 0;

    transition:
      opacity 0.22s ease;
  }

  .desktop-bottom-nav-btn.active::before {
    opacity: 1;
  }

  .desktop-bottom-nav-btn.active img {
    filter:
      brightness(0)
      saturate(100%)
      invert(47%)
      sepia(91%)
      saturate(1513%)
      hue-rotate(305deg)
      brightness(103%)
      contrast(101%);
  }

  .desktop-bottom-nav-btn.active span {
    color: #ff5181;
  }
}






.desktop-reverse-page {
  display: none;
}

@media (min-width: 769px) {
  body.desktop-reverse-open #photoBookApp {
    display: block;

    width: 100%;
    height: 930px;

    overflow-y: auto;

    background: #f5f5f5;
  }

  body.desktop-reverse-open
  #photoBookApp > .left-panel,

  body.desktop-reverse-open
  #photoBookApp > .center-panel
  > :not(.desktop-reverse-page):not(.desktop-bottom-menu) {
    display: none !important;
  }

  body.desktop-reverse-open
  #photoBookApp > .center-panel {
    display: block;

    width: 100%;
    min-height: calc(100vh - 45px);

    overflow: visible;

    padding: 0;

    box-sizing: border-box;
  }

  body.desktop-reverse-open
  .desktop-reverse-page {
    display: block;

    width: 100%;

    padding:
      42px
      42px
      120px;

    box-sizing: border-box;
  }
}

@media (min-width: 769px) {
  #desktopPagesManagerGrid {
    display: grid;

    grid-template-columns:
      repeat(5, minmax(0, 1fr));

    gap: 42px 22px;

    width: calc(100% - 80px);
    max-width: 1500px;

    margin: 0 auto;
    padding: 0 0 50px;

    box-sizing: border-box;
  }

  #desktopPagesManagerGrid
  .mobile-manager-spread {
    width: 100%;
    min-width: 0;

    display: flex;
    flex-direction: column;

    background: transparent;

    border: none;
    border-radius: 0;

    box-shadow: none;
  }

  #desktopPagesManagerGrid
  .mobile-manager-spread-pages {
    position: relative;

    display: flex;

    width: 100%;
    aspect-ratio: 2 / 1.127;

    overflow: visible;

    background: transparent;

    border: none;
    border-radius: 0;

    box-shadow: none;

    box-sizing: border-box;
  }

  #desktopPagesManagerGrid
  .mobile-manager-page-preview {
    position: relative;

    width: 50%;
    height: 100%;
    min-width: 0;

    overflow: hidden;

    background: #ffffff;

    border:
      1px solid
      #d8d8d8;

    box-sizing: border-box;

    cursor: grab;
  }

  #desktopPagesManagerGrid
  .mobile-manager-page-preview:first-child {
    border-right: 0;
  }

  #desktopPagesManagerGrid
  .mobile-manager-page-preview:last-of-type {
    border-left:
      1px solid
      #d8d8d8;
  }

  #desktopPagesManagerGrid
  .mobile-manager-rendered-page {
    position: absolute !important;

    left: 0 !important;
    top: 0 !important;

    width: 360px !important;
    height: 406px !important;

    margin: 0 !important;
    padding: 0 !important;

    flex: none !important;

    border: none !important;
    box-shadow: none !important;

    transform-origin:
      top left !important;

    pointer-events: none !important;
  }

  #desktopPagesManagerGrid
  .mobile-manager-page-numbers {
    display: grid;

    grid-template-columns:
      repeat(2, minmax(0, 1fr));

    width: 100%;

    margin-top: 9px;

    font-family:
      "Montserrat",
      Arial,
      sans-serif;

    font-size: 12px;
    font-weight: 400;
    line-height: 1;

    color: #555;

    text-align: center;
  }

  #desktopPagesManagerGrid
  .mobile-manager-page-numbers span {
    display: block;

    min-width: 0;

    text-align: center;
  }

  #desktopPagesManagerGrid
  .mobile-manager-spread-center {
    position: absolute;

    left: 50%;
    top: 0;

    width: 34px;
    height: 100%;

    transform: translateX(-50%);

    background: transparent;

    z-index: 20;

    cursor: grab;
  }
}

@media (min-width: 769px) {
  #desktopPagesManagerGrid
  .mobile-manager-page-preview {
    cursor: grab;
    touch-action: none;
  }

  #desktopPagesManagerGrid
  .mobile-manager-page-preview:active {
    cursor: grabbing;
  }

  #desktopPagesManagerGrid
  .mobile-manager-spread-center {
    cursor: grab;
    touch-action: none;
  }

  #desktopPagesManagerGrid
  .mobile-manager-spread-center:active {
    cursor: grabbing;
  }

  body.desktop-reverse-open {
    user-select: none;
  }
}

@media (min-width: 769px) {

  /*
    Плавное движение страниц
    и разворотов при выборе места вставки.
  */
  #desktopPagesManagerGrid
  .mobile-manager-page-preview {
    transition:
      transform 0.22s cubic-bezier(.22, 1, .36, 1),
      opacity 0.18s ease,
      box-shadow 0.18s ease,
      filter 0.18s ease;
  }

  #desktopPagesManagerGrid
  .mobile-manager-spread {
    transition:
      transform 0.22s cubic-bezier(.22, 1, .36, 1),
      opacity 0.18s ease;
  }


  /*
    Перетаскиваемая исходная страница.
  */
  #desktopPagesManagerGrid
  .mobile-manager-page-preview.drag-active {
    opacity: 0.48;

    filter: saturate(0.75);

    box-shadow:
      inset 0 0 0 2px #ff5181;
  }


  /*
    Страница, на которую сейчас наведён курсор.
  */
  #desktopPagesManagerGrid
  .mobile-manager-page-preview.drag-target::after {
    content: "";

    position: absolute;
    inset: 0;

    z-index: 1000;

    pointer-events: none;

    border: 2px solid #ff5181;

    background:
      rgba(255, 81, 129, 0.08);

    box-sizing: border-box;

    animation:
      desktopReverseTargetPulse
      0.9s ease-in-out infinite;
  }


  /*
    Перетаскиваемый исходный разворот.
  */
  #desktopPagesManagerGrid
  .mobile-manager-spread-pages.drag-active {
    opacity: 0.48;

    filter: saturate(0.75);
  }

  #desktopPagesManagerGrid
  .mobile-manager-spread-pages.drag-active::after {
    content: "";

    position: absolute;
    inset: 0;

    z-index: 1000;

    pointer-events: none;

    border: 2px solid #ff5181;

    box-sizing: border-box;
  }


  /*
    Разворот, на который сейчас наведён курсор.
  */
  #desktopPagesManagerGrid
  .mobile-manager-spread-pages.drag-target::after {
    content: "";

    position: absolute;
    inset: 0;

    z-index: 1000;

    pointer-events: none;

    border: 2px solid #ff5181;

    background:
      rgba(255, 81, 129, 0.07);

    box-sizing: border-box;

    animation:
      desktopReverseTargetPulse
      0.9s ease-in-out infinite;
  }


  /*
    Раздвигание отдельных страниц
    при вставке между ними.
  */
  #desktopPagesManagerGrid
  .mobile-manager-page-preview.insert-shift-left {
    transform: translateX(-16px);
  }

  #desktopPagesManagerGrid
  .mobile-manager-page-preview.insert-shift-right {
    transform: translateX(16px);
  }


  /*
    Раздвигание разворотов
    при вставке между ними.
  */
  #desktopPagesManagerGrid
  .mobile-manager-spread.insert-shift-left {
    transform: translateX(-18px);
  }

  #desktopPagesManagerGrid
  .mobile-manager-spread.insert-shift-right {
    transform: translateX(18px);
  }


  /*
    Копия страницы или разворота,
    которая движется за курсором.
  */
 @media (min-width: 769px) {
  body.desktop-reverse-open
  .mobile-manager-drag-ghost {
    position: fixed !important;

    margin: 0 !important;

    overflow: hidden;

    opacity: 0.94;

    border: 2px solid #ff5181;

    background: #ffffff;

    box-shadow:
      0 18px 46px rgba(0, 0, 0, 0.24),
      0 0 0 6px rgba(255, 81, 129, 0.1);

    transform:
      translate(-50%, -50%)
      scale(1.045) !important;

    transform-origin: center center;

    animation: none !important;
    transition: none !important;

    pointer-events: none !important;

    z-index: 9999999;
  }
}


  /*
    Пунктирная линия вставки страницы.
  */
  body.desktop-reverse-open
  .mobile-manager-page-insert-line {
    width: 4px;

    border-radius: 999px;

    background:
      repeating-linear-gradient(
        to bottom,
        #ff5181 0,
        #ff5181 5px,
        transparent 5px,
        transparent 10px
      );

    filter:
      drop-shadow(
        0 0 5px
        rgba(255, 81, 129, 0.42)
      );
  }


  /*
    Пунктирная линия вставки разворота.
  */
  body.desktop-reverse-open
  .mobile-manager-spread-insert-line {
    width: 4px !important;

    border-radius: 999px;

    background:
      repeating-linear-gradient(
        to bottom,
        #ff5181 0,
        #ff5181 5px,
        transparent 5px,
        transparent 10px
      );

    filter:
      drop-shadow(
        0 0 5px
        rgba(255, 81, 129, 0.42)
      );
  }
}


@keyframes desktopReverseTargetPulse {
  0%,
  100% {
    background:
      rgba(255, 81, 129, 0.05);
  }

  50% {
    background:
      rgba(255, 81, 129, 0.14);
  }
}

@media (min-width: 769px) {
  body.desktop-reverse-open
  .mobile-manager-page-insert-line,
  body.desktop-reverse-open
  .mobile-manager-spread-insert-line {
    position: fixed !important;

    display: none;

    width: 4px !important;

    pointer-events: none !important;

    border-radius: 999px;

    background:
      repeating-linear-gradient(
        to bottom,
        #ff5181 0,
        #ff5181 6px,
        transparent 6px,
        transparent 11px
      ) !important;

    transform:
      translate(-50%, -50%) !important;

    filter:
      drop-shadow(
        0 0 6px
        rgba(255, 81, 129, 0.7)
      );

    z-index: 99999999 !important;
  }

  body.desktop-reverse-open
  .mobile-manager-page-insert-line.show,
  body.desktop-reverse-open
  .mobile-manager-spread-insert-line.show {
    display: block !important;
  }
}

@media (min-width: 769px) {

  .page-slot.gallery-drop-target {
    z-index: 100 !important;
  }

  .page-slot.gallery-drop-target::after {
    content: "";

    position: absolute;
    inset: 0;

    box-sizing: border-box;

    border: 5px solid #ff5b8f;
    border-radius: inherit;

    background: rgba(255, 91, 143, 0.14);

    box-shadow:
      inset 0 0 0 2px rgba(255, 255, 255, 0.9),
      0 0 0 2px rgba(255, 91, 143, 0.25);

    pointer-events: none;
    z-index: 999;
  }

  body.gallery-photo-dragging .page-slot {
    transition:
      box-shadow 0.12s ease,
      background-color 0.12s ease;
  }
}

.desktop-gallery-item,
.mobile-gallery-item {
  position: relative;
}

.gallery-photo-delete {
  position: absolute;

  top: 1px;
  right: 1px;

  width: 28px;
  height: 28px;

  padding: 0;
  margin: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  border: none;
  border-radius: 0;

  background: transparent;
  box-shadow: none;

  cursor: pointer;
  z-index: 50;

  transition:
    transform 0.15s ease,
    opacity 0.15s ease;
}

.gallery-photo-delete:hover {
  background: transparent;
  transform: scale(1.08);
}

.gallery-photo-delete:active {
  transform: scale(0.92);
}

.gallery-photo-delete img {
  display: block;

  width: 22px;
  height: 22px;

  object-fit: contain;
  pointer-events: none;
}

.gallery-photo-delete:disabled {
  opacity: 0.45;
  cursor: wait;
  pointer-events: none;
}

@media (max-width: 768px) {
  .gallery-photo-delete {
    top: 1px;
    right: 1px;

    width: 30px;
    height: 30px;
  }

  .gallery-photo-delete img {
    width: 23px;
    height: 23px;
  }
}

@media (max-width: 768px) {
  /*
   * Доступное действие.
   * Сами SVG уже розовые.
   */
  .cover-state-btn:not(:disabled) {
    opacity: 1;
    cursor: pointer;
  }

  .cover-state-btn:not(:disabled) img {
    opacity: 1;
    filter: none;
  }

  .cover-state-btn:not(:disabled) span {
    color: #FF5181;
  }

  /*
   * Недоступное действие.
   */
  .cover-state-btn:disabled {
    opacity: 1;
    cursor: default;
  }

  .cover-state-btn:disabled img {
    opacity: 0.35;
    filter: grayscale(1);
  }

  .cover-state-btn:disabled span {
    color: #b8b8b8;
  }

  /*
   * Не показываем анимацию нажатия
   * у отключённой кнопки.
   */
  .cover-state-btn:disabled:active {
    background: transparent;
    transform: none;
  }
}


@media (max-width: 768px) {
  .mobile-gallery-item
  .gallery-photo-delete {
    z-index: 100 !important;
    pointer-events: auto !important;
    touch-action: manipulation;
  }
}

.editor-text-value {
  display: inline;
  white-space: nowrap;
}


.font-denistina {
  display: inline-block !important;

  width: max-content !important;
  min-width: max-content !important;
  max-width: none !important;

  padding-right: 0 !important;
  padding-bottom: 0.12em !important;

  box-sizing: content-box !important;

  line-height: 1.12 !important;
  white-space: nowrap !important;

  overflow: visible !important;

  will-change: auto !important;
  contain: none !important;
  clip-path: none !important;
}

.font-denistina
.denistina-end-reserve {
  display: inline-block;

  width: 0.28em;
  height: 1px;

  font: inherit;

  pointer-events: none;
  user-select: none;
}



@media (max-width: 768px) {

  /*
   * Увеличиваем панель страницы:
   * верхняя строка — категории,
   * нижняя — шаблоны.
   */
  body:not(.cover-editor-mobile-open)
  .left-panel.open {
    height: 184px !important;

    padding: 10px !important;

    overflow: hidden !important;
  }


  body:not(.cover-editor-mobile-open)
  .left-panel.open
  #desktopTemplatesContent {
    width: 100% !important;
    height: 100% !important;

    display: flex !important;
    flex-direction: column;

    overflow: hidden;
  }



  .page-template-categories::-webkit-scrollbar {
    display: none;
  }


  .page-template-category-btn {
    height: 32px;
    min-width: max-content;

    padding: 0 12px;

    flex: 0 0 auto;

    border-radius: 10px;

    font-size: 12px;

    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }


  /*
   * Отдельная прокрутка шаблонов,
   * чтобы категории не уезжали вместе с ними.
   */
  body:not(.cover-editor-mobile-open)
  .left-panel.open
  .templates-grid {
    width: 100% !important;

    display: flex !important;
    flex-wrap: nowrap;

    gap: 10px;

    flex: 1 1 auto;

    overflow-x: auto;
    overflow-y: hidden;

    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;

    box-sizing: border-box;
  }


  body:not(.cover-editor-mobile-open)
  .left-panel.open
  .templates-grid::-webkit-scrollbar {
    display: none;
  }


  body:not(.cover-editor-mobile-open)
  .left-panel.open
  .template-card {
    width: 76px;
    height: 96px;

    flex: 0 0 76px;
  }


  /*
   * В редакторе обложки оставляем
   * прежнюю высоту панели.
   */
  body.cover-editor-mobile-open
  .left-panel.open {
    height: 130px !important;
  }


  body.cover-editor-mobile-open
  .page-template-categories {
    display: none !important;
  }

  
}

/* ==================================================
   ОФОРМЛЕНИЕ КАРТОЧЕК ШАБЛОНОВ
================================================== */

.template-frame-preview {
  position: absolute;

  z-index: 1;

  box-sizing: border-box;

  pointer-events: none;
}


.template-slot-preview {
  z-index: 2;
}


.template-card {
  overflow: hidden;
}

/* Декоративная рамка внутри страницы */

.page-template-frame {
  position: absolute;

  z-index: 1;

  box-sizing: border-box;

  pointer-events: none;
}


/*
 * Фотослоты располагаются
 * поверх декоративной рамки.
 */
.page .page-slot {
  z-index: 2;
}


/* ==================================================
   СЕТКА ФОТОРАМОК НА ПК
================================================== */

.desktop-photo-frames-grid {
  display: none;
}

@media (min-width: 769px) {

  body:not(.desktop-cover-editor-open)
  .center-panel {
    align-items: stretch;
    justify-content: flex-start;

    overflow-x: hidden;
    overflow-y: auto;

    padding: 110px 38px 120px;

    box-sizing: border-box;
  }

.desktop-photo-frames-grid {
  width: 100%;

  display: grid;
  grid-template-columns:
    repeat(4, minmax(0, 1fr));

  align-items: start;

  column-gap: 46px;
  row-gap: 24px;

  box-sizing: border-box;
}

.desktop-photo-grid-heading {
  min-width: 0;
  min-height: 24px;

  font-size: 17px;
  font-weight: 500;
  line-height: 1.2;

  color: #181818;
  text-align: center;

  box-sizing: border-box;
}

.desktop-photo-grid-heading--cover {
  grid-column: 1;
}

.desktop-photo-grid-heading--magnet {
  grid-column: 2;
}

.desktop-photo-grid-heading--photos {
  grid-column: 3 / -1;
}

.desktop-photo-magnet-card {
  grid-column: 2;
}

.desktop-photo-card {
  margin-bottom: 36px;
}

  .desktop-photo-card {
    appearance: none;
    -webkit-appearance: none;

    width: 100%;
    min-width: 0;

    padding: 0;

    display: flex;
    flex-direction: column;
    align-items: stretch;

    gap: 14px;

    border: none;
    background: transparent;

    color: #181818;
    font: inherit;

    cursor: pointer;
  }

  .desktop-photo-card__top-title {
    min-height: 24px;

    font-size: 17px;
    font-weight: 500;
    line-height: 1.2;

    text-align: left;
  }

  .desktop-photo-cover-preview {
    position: relative;

    width: 100%;
aspect-ratio: 815 / 532;

    overflow: hidden;

    background: #ffffff;
  }

  .desktop-photo-cover-canvas {
    position: absolute;

    top: 0;
    left: 0;

    pointer-events: none;
  }

  .desktop-photo-frame {
    position: relative;

    width: 100%;
    height: auto;

    border: 1px solid #d5d5d5;
    background: #ffffff;

    box-sizing: border-box;
    overflow: hidden;

    cursor: pointer;
  }

  .desktop-photo-frame-number {
    min-height: 20px;

    font-size: 14px;
    font-weight: 400;
    line-height: 1;

    color: #181818;
    text-align: center;
  }


  .desktop-photo-cover-card.active
  .desktop-photo-cover-preview {
    outline: 2px solid #ff5181;
    outline-offset: 3px;
  }

  /*
   * Старый разворот остаётся в DOM,
   * но на ПК больше не показывается.
   */
  .book-spread,
  .page-numbers {
    display: none !important;
  }
}


@media (min-width: 769px) {

  /*
   * В редакторе 50 фоторамок
   * скрываем текст и удаление.
   */
  .center-panel:not(.cover-mode)
  .desktop-center-tools {
    display: none;
  }

  /*
   * В редакторе коробки
   * возвращаем оба инструмента.
   */
  .center-panel.cover-mode
  .desktop-center-tools {
    display: flex;
  }
}

@media (min-width: 769px) {

  /*
   * В редакторе фоторамок
   * скрываем историю изменений.
   */
  .center-panel:not(.cover-mode)
  .desktop-history-actions {
    display: none !important;
  }

  /*
   * В редакторе коробки
   * кнопки назад и вперёд оставляем.
   */
  .center-panel.cover-mode
  .desktop-history-actions {
    display: flex;
  }
}

.project-preview-grid {
  width: 100%;
  display: grid;
  align-items: start;
  box-sizing: border-box;
}

.project-preview-card {
  width: 100%;
  min-width: 0;

  display: flex;
  flex-direction: column;
  align-items: stretch;

  box-sizing: border-box;
}

.project-preview-frame.page {
  position: relative;

  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;

  flex: none !important;

  overflow: hidden;

  background: #ffffff;
  border: 1px solid #d7d7d7;
  outline: none !important;
  box-shadow: none !important;

  box-sizing: border-box;
}

.project-preview-frame,
.project-preview-frame * {
  pointer-events: none !important;

  user-select: none !important;
  -webkit-user-select: none !important;
}

.project-preview-number {
  width: 100%;
  margin-top: 10px;

  color: #555;
  font-size: 14px;
  font-weight: 400;
  line-height: 1;

  text-align: center;
}

@media (min-width: 769px) {
  #desktopPagesManagerGrid.project-preview-grid {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));

    width: min(100%, 1100px);
    margin: 0 auto;

    column-gap: 50px;
    row-gap: 65px;
  }
}

@media (max-width: 768px) {
  #mobilePagesManagerGrid.project-preview-grid {
    grid-template-columns: minmax(0, 1fr);

    width: 100%;
    max-width: 430px;
    margin: 0 auto;

    row-gap: 42px;
  }
}

@media (max-width: 768px) {

  /*
   * Мобильная панель форматов.
   * Редактор коробки не затрагиваем.
   */
  body:not(.cover-editor-mobile-open)
  .left-panel.open {
    left: 12px !important;
    right: 12px !important;

    bottom:
      calc(
        84px + env(safe-area-inset-bottom)
      ) !important;

    width: auto !important;
    height: 164px !important;

    padding: 12px 10px !important;

    overflow: hidden !important;

    background: #ffffff !important;
    border: none !important;
    border-radius: 22px !important;

    box-sizing: border-box !important;
  }

  /*
   * Убираем серую строку «Форматы».
   * Категория у нас теперь только одна.
   */
  body:not(.cover-editor-mobile-open)
  .left-panel.open
  #pageTemplateCategories {
    display: none !important;
  }

  /*
   * Контейнер шаблонов занимает
   * всю высоту панели.
   */
  body:not(.cover-editor-mobile-open)
  .left-panel.open
  #desktopTemplatesContent {
    display: block !important;

    width: 100% !important;
    height: 100% !important;

    overflow: hidden !important;
  }

  /*
   * Горизонтальная прокрутка форматов.
   */
  body:not(.cover-editor-mobile-open)
  .left-panel.open
  .templates-grid {
    display: flex !important;
    align-items: center !important;
    flex-wrap: nowrap !important;

    width: 100% !important;
    height: 100% !important;

    gap: 12px !important;

    padding: 0 2px 2px !important;

    overflow-x: auto !important;
    overflow-y: hidden !important;

    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;

    box-sizing: border-box !important;
  }

  body:not(.cover-editor-mobile-open)
  .left-panel.open
  .templates-grid::-webkit-scrollbar {
    display: none;
  }

  /*
   * Карточки форматов делаем крупнее
   * и не даём им сжиматься.
   */
  body:not(.cover-editor-mobile-open)
  .left-panel.open
  .template-card {
    width: 90px !important;
    height: 122px !important;

    flex: 0 0 90px !important;

    margin: 0 !important;
    box-sizing: border-box !important;
  }
}

/* Кнопка выхода из редактора обложки */

.desktop-history-actions {
  position: absolute !important;

  top: 0 !important;
  left: 16px !important;

  width: auto !important;
  height: 54px !important;

  display: flex !important;
  align-items: center !important;

  z-index: 100 !important;
}

.cover-back-to-frames-btn {
  width: auto !important;
  height: 54px !important;

  padding: 0 18px !important;

  border: 1px solid #e6e6e6 !important;
  border-radius: 18px !important;

  background: #ffffff !important;

  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;

  font-family: "Montserrat", Arial, sans-serif !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  line-height: 1 !important;

  color: #333333 !important;

  cursor: pointer !important;
  white-space: nowrap !important;

  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.06) !important;
}

.cover-back-to-frames-btn img {
  width: 20px !important;
  height: 20px !important;

  min-width: 20px !important;
  min-height: 20px !important;

  max-width: 20px !important;
  max-height: 20px !important;

  display: block !important;
  flex: 0 0 20px !important;

  object-fit: contain !important;
}

.cover-back-to-frames-btn span {
  display: block !important;
  line-height: 1 !important;
}

.cover-back-to-frames-btn:hover {
  background: #f7f7f7 !important;
}

/*
 * ПК: пропорционально уменьшаем
 * весь редактор фотографии.
 *
 * Мобильную версию не затрагиваем.
 */
@media (min-width: 769px) {
  .photo-editor-modal {
    align-items: center !important;
    justify-content: center !important;

    padding: 0 !important;
    overflow: hidden !important;
  }

  .photo-editor-modal__box {
    width: 600px !important;
    height: 900px !important;

    min-width: 600px !important;
    min-height: 900px !important;

    max-width: none !important;
    max-height: none !important;

    flex: 0 0 auto !important;

    transform:
      scale(
        var(--photo-editor-fit-scale, 1)
      ) !important;

    transform-origin:
      center center !important;
  }
}

/* ==========================================
   МОБИЛЬНАЯ ПАНЕЛЬ ШАБЛОНОВ КОРОБКИ
========================================== */

@media (max-width: 768px) {

  /*
   * Увеличенная нижняя панель.
   */
  body.cover-editor-mobile-open
  .left-panel.open {
    left: 12px !important;
    right: 12px !important;

    bottom:
      calc(
        84px + env(safe-area-inset-bottom)
      ) !important;

    width: auto !important;
height: 180px !important;
padding: 10px !important;

    overflow: hidden !important;

    box-sizing: border-box !important;
  }

  /*
   * Контейнер шаблонов занимает
   * всю высоту панели.
   */
  body.cover-editor-mobile-open
  .left-panel.open
  #desktopTemplatesContent {
    display: block !important;

    width: 100% !important;
    height: 100% !important;

    overflow: hidden !important;
  }

  /*
   * Горизонтальная прокрутка шаблонов.
   */
  body.cover-editor-mobile-open
  .left-panel.open
  .templates-grid.cover-mode {
    display: flex !important;
    align-items: center !important;
    flex-wrap: nowrap !important;

    width: max-content !important;
    height: 100% !important;

    gap: 12px !important;
    padding: 0 !important;

    overflow-x: auto !important;
    overflow-y: hidden !important;

    scrollbar-width: none;

    box-sizing: border-box !important;
  }

  body.cover-editor-mobile-open
  .left-panel.open
  .templates-grid.cover-mode::-webkit-scrollbar {
    display: none;
  }

  /*
   * Шаблон почти во всю ширину телефона.
   */
body.cover-editor-mobile-open
.left-panel.open
.cover-template-card {
  width:
    min(
      230px,
      calc(100vw - 80px)
    ) !important;

  height: auto !important;

  aspect-ratio:
    815 / 532 !important;

  flex:
    0 0
    min(
      230px,
      calc(100vw - 80px)
    ) !important;

  margin: 0 !important;

  border-radius: 14px !important;

  box-sizing: border-box !important;
}
}

/* ==========================================
   ПК: ВЕРХНИЕ КНОПКИ ФОРМАТОВ
========================================== */

@media (min-width: 769px) {

  .desktop-photo-format-panel {
    position: absolute;

    top: 0;
    left: 50%;
    transform: translateX(-50%);

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    height: 54px;

    z-index: 100;
  }

  /*
   * Показываем форматы только
   * в редакторе фоторамок.
   */
  .center-panel:not(.cover-mode)
  .desktop-photo-format-panel {
    display: flex !important;
  }

  /*
   * В редакторе коробки скрываем.
   */
  .center-panel.cover-mode
  .desktop-photo-format-panel {
    display: none !important;
  }

  .desktop-photo-format-btn {
    width: auto;
    height: 44px;

    padding: 0 18px;

    border: 1px solid #e6e6e6;
    border-radius: 18px;

    background: #ffffff;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    font-family:
      "Montserrat",
      Arial,
      sans-serif;

    font-size: 13px;
    font-weight: 500;
    line-height: 1;

    color: #333333;

    cursor: pointer;
    white-space: nowrap;

    box-shadow:
      0 4px 14px
      rgba(0, 0, 0, 0.06);

    transition:
      background 0.18s ease,
      border-color 0.18s ease,
      color 0.18s ease,
      transform 0.18s ease;
  }

  .desktop-photo-format-btn:hover {
    background: #f7f7f7;
  }

  .desktop-photo-format-btn:active {
    transform: scale(0.97);
  }

  /*
   * Выбранный формат.
   */
  .desktop-photo-format-btn.active {
    border-color: #FF5181;
    background: #FFF0F4;
    color: #FF5181;
  }
}

/* ==========================================
   ПК: КОРОБКА И МАГНИТ В ПЕРВОЙ СТРОКЕ
========================================== */

@media (min-width: 769px) {

  .desktop-photo-frames-grid {
    grid-template-columns:
      minmax(0, 1fr) !important;

    column-gap: 0 !important;
    row-gap: 42px !important;
  }

  /*
   * Верхняя строка:
   * коробка и магнит.
   *
   * Сохраняем размеры карточек как
   * в основной четырёхколоночной сетке.
   */
  .desktop-product-top-grid {
    width: 100%;
    max-width: 650px;
    min-width: 0;

    margin: 0 auto;

    display: grid;
    grid-template-columns:
      minmax(0, 2.25fr)
      minmax(0, 1fr);

    column-gap: 46px;
    row-gap: 24px;

    align-items: start;
    box-sizing: border-box;
  }

  .desktop-product-top-grid
  .desktop-photo-grid-heading--cover {
    grid-column: 1;
    grid-row: 1;
  }

  .desktop-product-top-grid
  .desktop-photo-grid-heading--magnet {
    grid-column: 2;
    grid-row: 1;
  }

  .desktop-product-top-grid
  .desktop-photo-cover-card {
    grid-column: 1;
    grid-row: 2;
  }

  .desktop-product-top-grid
  .desktop-photo-magnet-card {
    grid-column: 2;
    grid-row: 2;
  }

  /*
   * Блок основных фотографий ниже.
   */
  .desktop-main-photos-section {
    width: 100%;
    min-width: 0;

    box-sizing: border-box;
  }

  .desktop-main-photos-section
  .desktop-photo-grid-heading--photos {
    width: 100%;

    margin-bottom: 24px;

    text-align: center;
    grid-column: auto;
  }

  .desktop-main-photos-grid {
    width: 100%;
    min-width: 0;

    display: grid;
    grid-template-columns:
      repeat(4, minmax(0, 1fr));

    column-gap: 46px;
    row-gap: 24px;

    align-items: start;
    box-sizing: border-box;
  }
}