/* ==========================================================================
   Photo-Samara — стили страницы просмотра фотографии
   Подключается только на странице photo/show, отдельно от глобальных
   стилей сайта (public/css/style.css)
   ========================================================================== */

/* --- Служебные элементы страницы --- */
/* Уведомления (toast notifications) */
  .toast-notification {
    position: fixed;
    top: 80px;
    right: 20px;
    max-width: 400px;
    padding: 16px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    z-index: 100000;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: slideInRight 0.3s ease-out;
  }
  @keyframes slideInRight {
    from {
      transform: translateX(400px);
      opacity: 0;
    }
    to {
      transform: translateX(0);
      opacity: 1;
    }
  }
  .toast-notification.hiding {
    animation: slideOutRight 0.3s ease-out forwards;
  }
  @keyframes slideOutRight {
    from {
      transform: translateX(0);
      opacity: 1;
    }
    to {
      transform: translateX(400px);
      opacity: 0;
    }
  }
  .toast-notification.success {
    border-left: 4px solid #10b981;
  }
  .toast-notification.success .toast-icon {
    color: #10b981;
  }
  .toast-notification.error {
    border-left: 4px solid #ef4444;
  }
  .toast-notification.error .toast-icon {
    color: #ef4444;
  }
  .toast-notification.warning {
    border-left: 4px solid #f59e0b;
  }
  .toast-notification.warning .toast-icon {
    color: #f59e0b;
  }
  .toast-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
  }
  .toast-content {
    flex: 1;
  }
  .toast-title {
    font-weight: 600;
    font-size: 15px;
    color: #1f2937;
    margin-bottom: 4px;
  }
  .toast-message {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.5;
  }
  .toast-close {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .toast-close:hover {
    color: #4b5563;
  }

  /* Стили для режима кропа */
  .cropping .photo-container {
    position: relative !important;
  }

  /* Скрываем оригинальное изображение во время кропа */
  .cropping #im {
    display: none;
  }

  /* Скрываем боковую панель во время кропа */
  .cropping #panel {
    display: none;
  }

  /* Контейнер для кропа - позиционируется абсолютно на месте #im */
  #crop-wrapper {
    display: none;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
  }
  .cropping #crop-wrapper {
    display: block;
  }
  /* Стили применяются только до инициализации Cropper.js */
  #crop-wrapper img:not(.cropper) {
    max-width: 100%;
    max-height: 70vh;
    width: auto;
    height: auto;
    display: block;
    margin: 0 auto;
    position: relative;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  }
  /* После инициализации Cropper.js - позволяем Cropper управлять размерами */
  #crop-wrapper img.cropper {
    display: block;
    max-width: none !important;
    max-height: none !important;
  }
  /* Важно для Cropper.js - не перебиваем размеры */

  /* Усиливаем оригинальные стили Cropper.js - делаем линии более видимыми */
  .cropper-line {
    background-color: #00ff00 !important;
    opacity: 1 !important;
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.9)) !important;
  }
  .cropper-line.line-n,
  .cropper-line.line-s {
    height: 3px !important;
  }
  .cropper-line.line-e,
  .cropper-line.line-w {
    width: 3px !important;
  }

  /* Угловые точки - больше и заметнее */
  .cropper-point {
    background-color: #00ff00 !important;
    opacity: 1 !important;
    width: 12px !important;
    height: 12px !important;
    border-radius: 50% !important;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.9) !important;
  }
  .cropper-point.point-se {
    width: 20px !important;
    height: 20px !important;
  }

  /* Рамка выделения - более контрастная */
  .cropper-view-box {
    outline: 2px solid #00ff00 !important;
    outline-color: rgba(0, 255, 0, 0.95) !important;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.7) !important;
  }

  .cropper-view-box outline {
    stroke: #00ff00 !important;
    stroke-width: 2 !important;
    stroke-opacity: 0.95 !important;
  }

  /* Сетка внутри кропа - более видимая */
  .cropper-dashed {
    border-color: rgba(255, 255, 255, 1) !important;
    opacity: 1 !important;
    border-width: 2px !important;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.8) !important;
  }
  .cropper-dashed.dashed-h {
    border-top: 2px solid rgba(255, 255, 255, 1) !important;
    border-bottom: 2px solid rgba(255, 255, 255, 1) !important;
  }
  .cropper-dashed.dashed-v {
    border-left: 2px solid rgba(255, 255, 255, 1) !important;
    border-right: 2px solid rgba(255, 255, 255, 1) !important;
  }

  .crop-actions-fixed {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    gap: 10px;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.8);
    padding: 15px 25px;
    border-radius: 8px;
  }
  .cropping .crop-actions-fixed {
    display: flex;
  }
  .crop-actions-fixed button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
  }
  .crop-actions-fixed .apply-crop {
    background: #4CAF50;
    color: white;
  }
  .crop-actions-fixed .apply-crop:hover {
    background: #45a049;
  }
  .crop-actions-fixed .cancel-crop {
    background: #f44336;
    color: white;
  }
  .crop-actions-fixed .cancel-crop:hover {
    background: #da190b;
  }
  .crop-actions-fixed .send-comment {
    background: #2196F3;
    color: white;
  }
  .crop-actions-fixed .send-comment:hover {
    background: #0b7dda;
  }
  
  /* Центрирование фото на странице */
  .photo-view #im {
    display: block;
    margin-left: auto;
    margin-right: auto;
  }
  
  /* Заголовок фото внутри контейнера на фоне */
  .photo-title-inside {
    font-size: 20px;
    font-weight: 600;
    text-align: center;
    padding: 10px 16px;
    color: #d1d5db;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  }
  
  .photo-view .photo-main-wrapper {
    margin-top: 0;
    padding-top: 0;
  }
  
  .photo-view .photo-display-section {
    margin-top: 0;
  }

/* --- Блок страницы фото --- */
/* Рейтинг за сегодня */
  .rating-today {
    margin-top: 8px;
    padding: 6px 10px;
    background: #f0f4f8;
    border-radius: 4px;
    font-size: 12px;
  }
  .rating-today-label {
    color: #666;
    margin-right: 6px;
  }
  .rating-today-value {
    color: #3d439b;
    font-weight: bold;
    margin-right: 4px;
  }
  .rating-today-votes {
    color: #888;
  }

  /* Стили панели смайликов — в public/css/emoji.css */

  /* Увеличенный размер текста в поле ввода */
  #comment-text {
    font-size: 18px !important;
    line-height: 1.6 !important;
    padding: 12px !important;
  }

  /* Модальное окно полного экрана */
  .fullscreen-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Фон под фото — цвет, выбранный автором (подставляется инлайном в разметке).
       Значение ниже — запасной вариант, если инлайн не сработал. */
    background-color: #ffffff;
    z-index: 10001;
    justify-content: center;
    align-items: center;
  }
  .fullscreen-modal-content {
    position: relative;
    max-width: 95%;
    max-height: 95%;
  }
  .fullscreen-modal-content img {
    max-width: 100%;
    max-height: 95vh;
    object-fit: contain;
    /* Тень отделяет фото от фона автора, даже если фон светлый */
    box-shadow: 0 4px 28px rgba(0, 0, 0, 0.28);
  }
  .fullscreen-modal-close {
    position: fixed;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    /* Круглая подложка — кнопка видна на любом фоне */
    background: rgba(0, 0, 0, 0.45);
    border: none;
    font-size: 26px;
    cursor: pointer;
    color: #fff;
    padding: 0;
    line-height: 1;
    transition: background-color 0.2s ease;
  }
  .fullscreen-modal-close:hover {
    background: rgba(0, 0, 0, 0.68);
    color: #fff;
  }

  /* Модальное окно жалобы */
  .report-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    justify-content: center;
    align-items: center;
  }
  .report-modal.active {
    display: flex;
  }
  .report-modal-content {
    background: white;
    border-radius: 8px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  }
  .report-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
  }
  .report-modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
  }
  .report-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .report-modal-close:hover {
    color: #333;
  }
  .report-modal-body {
    margin-bottom: 16px;
  }
  .report-modal-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #555;
    margin-bottom: 8px;
  }
  .report-modal-textarea {
    width: 100%;
    min-height: 120px;
    max-height: 300px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    resize: vertical;
    font-family: inherit;
    box-sizing: border-box;
  }
  .report-modal-textarea:focus {
    outline: none;
    border-color: #4a90d9;
    box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.1);
  }
  .report-modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
  }
  .report-modal-btn {
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
  }
  .report-modal-btn-cancel {
    background: #f5f5f5;
    color: #666;
  }
  .report-modal-btn-cancel:hover {
    background: #e8e8e8;
  }
  .report-modal-btn-submit {
    background: #dc3545;
    color: white;
  }
  .report-modal-btn-submit:hover {
    background: #c82333;
  }

  /* Уведомление (toast) */
  .toast-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10001;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease-out;
  }
  .toast-notification.success {
    background: #10b981;
    color: white;
  }
  .toast-notification.error {
    background: #ef4444;
    color: white;
  }
  .toast-notification.info {
    background: #3b82f6;
    color: white;
  }
  @keyframes slideIn {
    from {
      transform: translateX(100%);
      opacity: 0;
    }
    to {
      transform: translateX(0);
      opacity: 1;
    }
  }
  .toast-notification.hide {
    animation: slideOut 0.3s ease-out forwards;
  }
  @keyframes slideOut {
    from {
      transform: translateX(0);
      opacity: 1;
    }
    to {
      transform: translateX(100%);
      opacity: 0;
    }
  }

  /* Рейтинг и голосование */
  .photo-rating-block {
    margin-bottom: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 4px;
  }
  .rating-summary {
    text-align: center;
    margin-bottom: 15px;
  }
  .rating-value {
    font-size: 32px;
    font-weight: bold;
    color: #ff9800;
  }
  .rating-count {
    font-size: 12px;
    color: #666;
    display: block;
    margin-top: 5px;
  }
  .vote-form {
    text-align: center;
  }
  .vote-label {
    font-size: 13px;
    color: #666;
    margin-bottom: 10px;
  }
  .stars-input {
    display: inline-flex;
    gap: 5px;
  }
  .star-btn {
    background: none;
    border: none;
    font-size: 32px;
    color: #ddd;
    cursor: pointer;
    transition: color 0.2s;
    padding: 0;
    line-height: 1;
  }
  .star-btn.active {
    color: #ff9800;
  }
  .star-btn.hover {
    color: #ff9800;
  }
  .vote-status {
    font-size: 12px;
    margin-top: 10px;
    min-height: 18px;
  }
  .vote-status.success {
    color: #28a745;
  }
  .vote-status.error {
    color: #dc3545;
  }
  .vote-own,
  .vote-guest {
    font-size: 12px;
    color: #666;
    text-align: center;
  }
  .vote-own a,
  .vote-guest a {
    color: #007bff;
  }
  
  /* Инкогнито режим для фото */
  .incognito-author {
    color: #888;
    font-style: italic;
  }
  .incognito-timer {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    color: #e67e22;
    background: #fef5e7;
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid #f5d6a8;
  }
  .incognito-timer-info {
    font-size: 11px;
    color: #e67e22;
  }
  
  /* Бейдж автора в комментариях */
  .author-badge {
    color: #4a90d9;
    font-size: 11px;
    font-weight: normal;
    font-style: italic;
  }

  /* Теги фотографий */
  .photo-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
  }
  .tag-label {
    display: inline-block;
    padding: 4px 10px;
    background: #f0f4f8;
    color: #2c5282;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid #e2e8f0;
  }

  /* Бейдж сохранения параметров */
  .save-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 15px;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
    position: relative;
  }
  .save-badge-label {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
    opacity: 0.9;
  }
  .save-badge-close {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
  }
  .save-badge-close:hover {
    background: rgba(255, 255, 255, 0.3);
  }
  .save-badge.hiding {
    opacity: 0 !important;
    transform: translateY(-10px) !important;
  }
  /* Горизонтальный скролл на странице просмотра фото */
  body.photo-page,
  body.photo-page #basis {
    overflow-x: auto !important;
  }
  body.photo-page #basis {
    min-width: 0 !important;
  }

  /* Модальное окно списка реакций */
  .reactions-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
  }
  .reactions-modal.active {
    display: flex;
  }
  .reactions-modal-content {
    background: white;
    border-radius: 20px;
    padding: 28px;
    max-width: 480px;
    width: 90%;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
  }
  .reactions-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
  }
  .reactions-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
  }
  .reactions-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    line-height: 1;
  }
  .reactions-modal-close:hover {
    color: #374151;
  }
  .reactions-modal-body {
    overflow-y: auto;
    flex: 1;
  }
  .reactions-loading {
    text-align: center;
    padding: 32px;
    color: #9ca3af;
    font-size: 14px;
  }
  .reactions-empty {
    text-align: center;
    padding: 32px;
    color: #9ca3af;
    font-size: 14px;
  }
  .reaction-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 10px;
    margin-bottom: 6px;
  }
  .reaction-item-like {
    background: #f0fdf4;
  }
  .reaction-item-dislike {
    background: #fef2f2;
  }
  .reaction-user {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .reaction-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
  }
  .reaction-nick {
    font-weight: 600;
    font-size: 14px;
    color: #2563eb;
    text-decoration: none;
  }
  .reaction-nick:hover {
    text-decoration: underline;
  }
  .reaction-type-badge {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
  }
  .reaction-type-badge-like {
    background: #dcfce7;
    color: #166534;
  }
  .reaction-type-badge-dislike {
    background: #fee2e2;
    color: #991b1b;
  }
  .reaction-time {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 2px;
  }

  .voters-list-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
    transition: background 0.15s;
    vertical-align: middle;
    margin-left: 6px;
  }
  .voters-list-btn:hover {
    background: #e5e7eb;
  }

  .voters-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
  }
  .voters-modal.active {
    display: flex;
  }
  .voters-modal-content {
    background: white;
    border-radius: 20px;
    padding: 28px;
    max-width: 480px;
    width: 90%;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
  }
  .voters-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
  }
  .voters-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
  }
  .voters-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    line-height: 1;
  }
  .voters-modal-close:hover {
    color: #374151;
  }
  .voters-modal-body {
    overflow-y: auto;
    flex: 1;
  }
  .voters-loading {
    text-align: center;
    padding: 32px;
    color: #9ca3af;
    font-size: 14px;
  }
  .voters-empty {
    text-align: center;
    padding: 32px;
    color: #9ca3af;
    font-size: 14px;
  }
  .voter-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 10px;
    margin-bottom: 6px;
    background: #f9fafb;
  }
  .voter-user {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .voter-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
  }
  .voter-nick {
    font-weight: 600;
    font-size: 14px;
    color: #2563eb;
    text-decoration: none;
  }
  .voter-nick:hover {
    text-decoration: underline;
  }
  .voter-info {
    text-align: right;
    flex-shrink: 0;
  }
  .voter-stars {
    font-size: 14px;
    font-weight: 700;
    color: #f59e0b;
  }
  .voter-count {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 1px;
  }
  .voter-time {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 2px;
  }

/* --------------------------------------------------------------------------
   Изоляция блока комментариев от глобальных стилей сайта.
   Глобальные правила (.content1 p, .content1 h2/h5, header { float: left })
   не должны влиять на вёрстку комментариев.
   -------------------------------------------------------------------------- */
.comments-section h1,
.comments-section h2,
.comments-section h3,
.comments-section h4,
.comments-section h5,
.comments-section h6 {
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    clear: none;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
    text-align: left;
}

.comments-section p {
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    clear: none;
    font-size: inherit;
    color: inherit;
}

.comments-section header {
    float: none;
    width: auto;
    clear: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
}

.comments-section a {
    color: inherit;
    text-decoration: none;
}

.comments-section img {
    border: 0;
    max-width: 100%;
}

/* Глобальные правила сайта для .comment:
   .comment { margin: .2em 1em 0 1em; padding: .5em 0 .5em 1.5em; font-size: 12px }
   .comment p, .content1 .comment p { padding: 5px 0 0; margin: 0; font-size: 16px }
   Из-за них каждый вложенный ответ сдвигался вправо и становился уже. */
.comments-section .comment {
    margin: 0;
    padding: 0;
    font-size: 14px;
}

.comments-section .comment p {
    margin: 0;
    padding: 0;
    font-size: 14.5px;
}

.comments-section button,
.comments-section input,
.comments-section select,
.comments-section textarea {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: inherit;
}
/* --- Комментарии --- */
/* ==========================================================================
   Комментарии под фотографией
   ========================================================================== */
.comments-section,
.comments-section * {
    box-sizing: border-box;
}
.comments-section {
    flex: 1;
    min-width: 0;
    margin-top: 20px;
    padding: 0;
    background: transparent;
    border: none;
}
.comments-section .cmt-panel {
    background: #fff;
    border: 1px solid #e8ecf3;
    border-radius: 18px;
    box-shadow: 0 4px 18px rgba(23, 32, 56, 0.05);
    padding: 20px;
}
/* Шапка панели */
.comments-section .cmt-panel-head {
    /* Глобальное правило сайта header { float: left } — отключаем для панели */
    float: none;
    width: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 0 14px;
    margin-bottom: 16px;
    border-bottom: 1px solid #eef1f6;
}
.comments-section .cmt-panel-title {
    display: flex;
    align-items: center;
    gap: 10px;
}
.comments-section .cmt-panel-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 11px;
    background: linear-gradient(135deg, #eef0ff 0%, #e2e5ff 100%);
    color: #3d439b;
}
.comments-section .cmt-panel-icon svg {
    width: 18px;
    height: 18px;
}
.comments-section .cmt-panel-heading {
    margin: 0;
    padding: 0;
    background: none;
    clear: none;
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
    letter-spacing: -0.01em;
}
.comments-section .cmt-panel-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    background: #f1f3fb;
    color: #3d439b;
    font-size: 12px;
    font-weight: 700;
}
.comments-section .cmt-panel-meta {
    font-size: 13px;
    color: #98a2b3;
}
/* Форма комментария */
.comments-section .cmt-composer {
    margin-bottom: 20px;
    padding: 16px;
    background: linear-gradient(180deg, #fbfcff 0%, #f7f9fd 100%);
    border: 1px solid #e6eaf3;
    border-radius: 16px;
}
.comments-section .cmt-composer-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.comments-section .cmt-composer-head-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}
.comments-section .cmt-composer-title {
    margin: 0;
    padding: 0;
    background: none;
    clear: none;
    font-size: 15px;
    font-weight: 700;
    color: #1f2937;
}
.comments-section .cmt-composer-field {
    position: relative;
}
.comments-section .cmt-composer-field textarea {
    width: 100%;
    min-height: 92px;
    padding: 12px 48px 12px 14px;
    border: 1px solid #e3e8f0;
    border-radius: 12px;
    background: #fff;
    font-family: inherit;
    font-size: 14.5px;
    line-height: 1.55;
    color: #1f2937;
    resize: vertical;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.comments-section .cmt-composer-field textarea:focus {
    outline: none;
    border-color: #a5abdb;
    box-shadow: 0 0 0 3px rgba(61, 67, 155, 0.12);
}
/* Кнопка смайликов прижата к правому нижнему углу поля ввода.
   Остальные стили кнопки и панели — в public/css/emoji.css */
.comments-section .cmt-emoji {
    position: absolute;
    right: 10px;
    bottom: 10px;
}
.comments-section .cmt-composer-foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 12px;
}
.comments-section .cmt-composer-cancel {
    padding: 9px 16px;
    border: 1px solid #e3e8f0;
    background: #fff;
    color: #667085;
    border-radius: 10px;
    font-size: 13.5px;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
}
.comments-section .cmt-composer-cancel:hover {
    background: #f5f7fb;
    color: #344054;
}
.comments-section .cmt-composer-submit {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #4a4fa3 0%, #3d439b 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(61, 67, 155, 0.28);
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}
.comments-section .cmt-composer-submit svg {
    width: 16px;
    height: 16px;
}
.comments-section .cmt-composer-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(61, 67, 155, 0.34);
}
.comments-section .cmt-composer-submit:active {
    transform: translateY(0);
}
/* Список комментариев */
.comments-section .cmt-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.comments-section .comment-thread {
    margin: 0;
}
.comments-section .cmt-card {
    position: relative;
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid #edf0f6;
    border-radius: 14px;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.comments-section .cmt-card--root:hover {
    border-color: #dfe4f0;
    box-shadow: 0 6px 18px rgba(23, 32, 56, 0.06);
}
.comments-section .cmt-card--variant {
    background: linear-gradient(180deg, #fcfcff 0%, #f9faff 100%);
    border-color: #dcdff5;
}
.comments-section .cmt-card--active-variant,
.comments-section .comment--active-variant {
    border-color: #b9bfea;
    box-shadow: 0 0 0 3px rgba(61, 67, 155, 0.16);
}
/* Аватар */
.comments-section .cmt-avatar-col {
    flex-shrink: 0;
}
.comments-section .cmt-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    text-decoration: none;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    box-shadow: 0 0 0 2px #fff, 0 2px 6px rgba(23, 32, 56, 0.12);
}
.comments-section .cmt-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.comments-section .cmt-avatar svg {
    width: 20px;
    height: 20px;
}
.comments-section .cmt-avatar--guest {
    background: #e9ecf3;
    color: #98a2b3;
}
/* Тело комментария */
.comments-section .cmt-body {
    flex: 1;
    min-width: 0;
}
.comments-section .cmt-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 6px;
}
.comments-section .cmt-author {
    color: #1f2937;
    font-weight: 600;
    font-size: 14.5px;
    text-decoration: none;
}
.comments-section .cmt-author:hover {
    color: #3d439b;
    text-decoration: underline;
}
.comments-section .cmt-author--incognito {
    color: #667085;
    font-style: italic;
}
.comments-section .cmt-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.6;
    white-space: nowrap;
}
.comments-section .cmt-badge--author { background: #eef0ff; color: #4a4fa3; }
.comments-section .cmt-badge--admin { background: #fff1e6; color: #c2410c; }
.comments-section .cmt-badge--pending { background: #fff7e6; color: #b45309; }
.comments-section .cmt-badge--edited { background: #f2f4f7; color: #667085; }
.comments-section .cmt-date {
    color: #98a2b3;
    font-size: 12.5px;
}
.comments-section .cmt-content {
    /* Текст, бейдж варианта и фото — друг под другом.
       Раньше здесь был flex-строка, а у .cmt-text стоял flex: 1 1 320px:
       текст растягивался и отодвигал галерею с фото вправо (на ПК фото
       «уезжало» к краю карточки, на телефоне строка переносилась и было ок). */
    display: block;
    min-width: 0;
}
.comments-section .cmt-content > .photo-config-badge {
    margin-top: 8px;
}
.comments-section .cmt-text {
    width: 100%;
    margin: 0;
    padding: 0;
    clear: none;
    font-size: 14.5px;
    line-height: 1.6;
    color: #344054;
    /* break-word, а не anywhere: anywhere рвёт слова по буквам,
       когда колонка сужается при глубокой вложенности ответов */
    overflow-wrap: break-word;
    word-break: normal;
}
.comments-section .cmt-text a {
    color: #3d439b;
    text-decoration: underline;
}
.comments-section .cmt-text--deleted {
    color: #98a2b3;
    font-style: italic;
}
.comments-section .cmt-deleted-note {
    font-size: 11.5px;
    color: #b6bcc9;
}
/* Действия */
.comments-section .comment-btn {
    border: none;
    background: transparent;
    font: inherit;
    cursor: pointer;
}
.comments-section .cmt-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}
.comments-section .cmt-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 999px;
    font-size: 13px;
    color: #667085;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}
.comments-section .cmt-action svg {
    width: 16px;
    height: 16px;
}
.comments-section .cmt-action:hover {
    background: #f4f6fb;
    color: #3d439b;
}
.comments-section .cmt-action--like.active {
    background: #e9f7ef;
    color: #199e7d;
    border-color: #cdeee0;
}
.comments-section .cmt-action--dislike.active {
    background: #fdeeee;
    color: #d94f4f;
    border-color: #f7d5d5;
}
.comments-section .like-count,
.comments-section .dislike-count {
    font-weight: 700;
    min-width: 10px;
}
/* Меню "ещё" */
.comments-section .cmt-more {
    position: relative;
    margin-left: auto;
}
.comments-section .cmt-more-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    border-radius: 8px;
    color: #98a2b3;
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease;
}
.comments-section .cmt-more-btn svg {
    width: 18px;
    height: 18px;
}
.comments-section .cmt-more-btn:hover {
    background: #f4f6fb;
    color: #475467;
}
.comments-section .cmt-more-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    display: none;
    min-width: 212px;
    padding: 6px;
    background: #fff;
    border: 1px solid #e6eaf3;
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(23, 32, 56, 0.14);
    z-index: 30;
}
.comments-section .cmt-more--up .cmt-more-menu {
    top: auto;
    bottom: calc(100% + 6px);
}
.comments-section .cmt-more.is-open .cmt-more-menu {
    display: block;
}
.comments-section .cmt-menu-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 13.5px;
    color: #344054;
    text-decoration: none;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.comments-section .cmt-menu-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: #98a2b3;
}
.comments-section .cmt-menu-item:hover {
    background: #f4f6fb;
    color: #1f2937;
}
.comments-section .cmt-menu-item--danger {
    color: #d94f4f;
}
.comments-section .cmt-menu-item--danger svg {
    color: #d94f4f;
}
.comments-section .cmt-menu-item--danger:hover {
    background: #fdeeee;
    color: #c2413f;
}
/* Ответы */
.comments-section .cmt-replies {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
    padding-left: 18px;
    border-left: 2px solid #eceff6;
}
.comments-section .cmt-card--reply {
    padding: 12px 14px;
    background: #fbfcfe;
    border-color: #eef1f7;
    border-radius: 12px;
}
.comments-section .cmt-card--reply .cmt-avatar {
    width: 32px;
    height: 32px;
    font-size: 13px;
}
.comments-section .cmt-card--reply .cmt-avatar svg {
    width: 16px;
    height: 16px;
}
.comments-section .cmt-card--reply .cmt-text {
    font-size: 14px;
}
/* Третий уровень и глубже — приглушаем,
.comments-section чтобы не было "лестницы вправо" */
.comments-section .cmt-replies .cmt-replies {
    padding-left: 14px;
    border-left-style: dashed;
    border-left-color: #e4e8f1;
}
.comments-section .cmt-replies .cmt-replies .cmt-card--reply {
    background: transparent;
}
/* Пустое состояние */
.comments-section .cmt-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 34px 20px;
    text-align: center;
    border: 1px dashed #e2e7f0;
    border-radius: 14px;
    background: #fbfcfe;
}
.comments-section .cmt-empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    margin-bottom: 6px;
    border-radius: 14px;
    background: #eef0ff;
    color: #4a4fa3;
}
.comments-section .cmt-empty-icon svg {
    width: 22px;
    height: 22px;
}
.comments-section .cmt-empty-title {
    margin: 0;
    padding: 0;
    clear: none;
    font-size: 15px;
    font-weight: 700;
    color: #344054;
}
.comments-section .cmt-empty-text {
    margin: 0;
    padding: 0;
    clear: none;
    font-size: 13.5px;
    color: #98a2b3;
}
/* Уведомления и приглашение гостя */
.comments-section .cmt-notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    margin-bottom: 18px;
    border-radius: 14px;
}
.comments-section .cmt-notice--warning {
    background: linear-gradient(135deg, #fff8ec 0%, #fef3c7 100%);
    border: 1px solid #fcd9a0;
}
.comments-section .cmt-notice--danger {
    background: linear-gradient(135deg, #fff5f5 0%, #fee2e2 100%);
    border: 1px solid #fbc5c5;
}
.comments-section .cmt-notice-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    flex-shrink: 0;
}
.comments-section .cmt-notice--warning .cmt-notice-icon {
    background: rgba(245, 158, 11, 0.18);
    color: #d97706;
}
.comments-section .cmt-notice--danger .cmt-notice-icon {
    background: rgba(220, 38, 38, 0.1);
    color: #dc2626;
}
.comments-section .cmt-notice-icon svg {
    width: 19px;
    height: 19px;
}
.comments-section .cmt-notice-title {
    margin: 0 0 4px;
    padding: 0;
    background: none;
    clear: none;
    font-size: 14.5px;
    font-weight: 700;
    color: #7c2d12;
}
.comments-section .cmt-notice--danger .cmt-notice-title {
    color: #991b1b;
}
.comments-section .cmt-notice-text {
    margin: 0;
    padding: 0;
    clear: none;
    font-size: 13.5px;
    line-height: 1.5;
    color: #78350f;
}
.comments-section .cmt-notice--danger .cmt-notice-text {
    color: #7f1d1d;
}
.comments-section .cmt-guest-cta {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    margin-bottom: 18px;
    background: #f7f9fd;
    border: 1px solid #e6eaf3;
    border-radius: 14px;
    font-size: 13.5px;
    color: #667085;
}
.comments-section .cmt-guest-cta svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: #98a2b3;
}
.comments-section .cmt-guest-cta p {
    margin: 0;
}
.comments-section .cmt-guest-cta a {
    color: #3d439b;
    font-weight: 600;
}
/* Восстановление удалённого комментария */
.comments-section .cmt-restore {
    margin-top: 8px;
}
.comments-section .restore-comment-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border: 1px solid #a7e3c8;
    background: #ecfdf5;
    border-radius: 999px;
    font-size: 12.5px;
    color: #059669;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.comments-section .restore-comment-btn:hover {
    background: #d1fae5;
    border-color: #059669;
    color: #047857;
}
/* Inline-редактирование комментария */
.comments-section .comment-edit-textarea {
    width: 100%;
    min-height: 96px;
    padding: 10px 12px;
    border: 1px solid #a5abdb;
    border-radius: 12px;
    background: #fff;
    font-family: inherit;
    font-size: 14.5px;
    line-height: 1.55;
    color: #1f2937;
    resize: vertical;
}
.comments-section .comment-edit-textarea:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(61, 67, 155, 0.12);
}
.comments-section .comment-edit-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}
.comments-section .save-edit-btn,
.comments-section .cancel-edit-btn {
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.comments-section .save-edit-btn {
    background: linear-gradient(135deg, #4a4fa3 0%, #3d439b 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(61, 67, 155, 0.28);
}
.comments-section .save-edit-btn:hover {
    transform: translateY(-1px);
}
.comments-section .cancel-edit-btn {
    background: #fff;
    border-color: #e3e8f0;
    color: #667085;
}
.comments-section .cancel-edit-btn:hover {
    background: #f5f7fb;
    color: #344054;
}
.comments-section .comment-edit-hint {
    margin: 6px 0 0;
    padding: 0;
    clear: none;
    font-size: 11.5px;
    color: #98a2b3;
}
.comments-section .comment-edit-hint--admin {
    color: #199e7d;
}
/* Вариант обработки внутри комментария */
.comments-section .photo-config-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #eef0ff;
    color: #4a4fa3;
    border: 1px solid #dcdff7;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
}
.comments-section .photo-config-badge:hover {
    background: #e3e6ff;
    color: #3d439b;
}
.comments-section .photo-config-badge svg {
    width: 15px;
    height: 15px;
}
.comments-section .photo-config-badge .config-text {
    white-space: nowrap;
}
/* ==========================================================================
   Выдвижное меню (страница фотографии на телефоне)
   Базовое скрытие этих элементов — в css/style.css, чтобы на других
   страницах сайта блок меню не появлялся.
   ========================================================================== */

/* ==========================================================================
   Адаптив
   Страница фотографии на телефоне: всё помещается в ширину экрана,
   комментарии читаются целиком, ответы не уходят за край.
   ========================================================================== */
@media (max-width: 1000px) {

    /* Фото, панель инструментов и сайдбар */
    body.photo-page #ipad {
        padding: 10px;
    }

    body.photo-page .photo-info-sidebar {
        overflow-x: auto;
    }

    /* Панель инструментов под фото на телефоне: две прокручиваемые строки —
       палитра фона и кнопки действий */
    body.photo-page #panel {
        margin: 10px 0 0;
        padding: 10px 12px;
        background: #fff;
        border: 1px solid #edf0f6;
        border-radius: 12px;
        overflow: visible;
    }

    body.photo-page .photo-tools {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    body.photo-page .tools-row {
        gap: 8px;
        min-width: 0;
    }

    /* Подпись «Фон:» — по верхнему краю палитры, а не посередине */
    body.photo-page .tools-row--bg {
        align-items: flex-start;
    }

    body.photo-page .tools-label {
        line-height: 24px;
    }

    /* Палитра фона — сеткой 8 в ряд, две строки, чтобы целиком
       помещалась на телефоне без горизонтальной прокрутки */
    body.photo-page .tools-palette {
        flex: 0 1 auto;
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        width: 220px;
    }

    body.photo-page .tools-palette i {
        flex: 0 0 auto;
        width: 24px;
        height: 24px;
        margin: 0;
        border-radius: 7px;
        border: 1px solid #d5d9e4;
    }

    /* Кнопки действий — компактные, переносятся на следующий ряд,
       чтобы все инструменты были видны без горизонтальной прокрутки */
    body.photo-page .tools-row--actions {
        flex-wrap: wrap;
        gap: 8px;
        overflow: visible;
    }

    body.photo-page .tools-row--actions > * {
        flex: 0 0 auto;
    }

    body.photo-page .photo-tools .tool-btn {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        padding: 8px 11px;
        margin: 0;
        font-size: 12.5px;
        border-radius: 9px;
        white-space: nowrap;
        background: #eef0ff;
        border-color: #dcdff7;
        color: #3d439b;
    }

    body.photo-page .photo-tools .tool-btn:active {
        background: #dfe2ff;
    }

    body.photo-page .photo-tools .tool-btn--danger {
        color: #dc3545;
        background: #fdeef0;
        border-color: #f7d5da;
    }

    body.photo-page .photo-tools .tool-btn--primary {
        color: #2563eb;
        background: #eaf2ff;
        border-color: #cfe0ff;
    }

    body.photo-page .photo-tools .tool-btn--muted {
        color: #98a2b3;
        background: #f2f4f8;
        border-color: #e3e7ef;
    }

    /* Кнопки «Поделиться» — прижаты к правому краю своей строки */
    body.photo-page .tools-row--actions .ya-share2 {
        gap: 6px;
        margin-left: auto;
    }

    body.photo-page .photo-bottom-grid {
        padding: 0 10px;
        gap: 14px;
    }

}

@media (max-width: 640px) {
    /* Панель комментариев */
    .comments-section .cmt-panel {
        padding: 12px;
        border-radius: 14px;
    }

    .comments-section .cmt-panel-heading {
        font-size: 16px;
    }

    .comments-section .cmt-panel-meta {
        font-size: 12px;
    }

    /* Карточка комментария */
    .comments-section .cmt-card {
        padding: 8px 10px;
        gap: 6px;
    }

    .comments-section .cmt-avatar {
        width: 30px;
        height: 30px;
        font-size: 13px;
    }

    .comments-section .cmt-card--reply .cmt-avatar {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }

    /* Длинные слова и ссылки переносятся, а не вылезают за край.
       Только break-word: anywhere рвёт слова по буквам в узкой колонке. */
    .comments-section .comment .cmt-text,
    .comments-section .cmt-text {
        font-size: 14px;
        overflow-wrap: break-word;
        word-break: normal;
    }

    /* Дата не разрывается на две строки */
    .comments-section .cmt-date {
        white-space: nowrap;
    }

    /* Аватар оставляем только у ответов первого уровня — он показывает,
       кому отвечают. На 2+ уровнях аватар убран: каждый уровень иначе
       съедает 30px ширины и текст превращается в столбик из букв */
    .comments-section .cmt-card--reply .cmt-avatar-col {
        display: none;
    }

    .comments-section .cmt-replies > .cmt-card--reply .cmt-avatar-col {
        display: block;
    }

    .comments-section .cmt-replies .cmt-replies .cmt-card--reply .cmt-avatar-col {
        display: none;
    }

    /* Внутренний отступ карточки ответа минимальный */
    .comments-section .cmt-card--reply {
        padding: 6px 4px;
    }

    /* Отступы ответов не накапливаются линейно, а быстро уменьшаются:
       иначе на 5-6 уровне ширина текста падает до 100px */
    .comments-section .cmt-replies {
        padding-left: 10px;
        border-left-width: 2px;
    }

    .comments-section .cmt-replies .cmt-replies {
        padding-left: 6px;
    }

    .comments-section .cmt-replies .cmt-replies .cmt-replies,
    .comments-section .cmt-replies .cmt-replies .cmt-replies .cmt-replies {
        padding-left: 3px;
    }

    .comments-section .cmt-action {
        padding: 4px 8px;
        font-size: 12.5px;
    }

    /* Форма комментария */
    .comments-section .cmt-composer {
        padding: 12px;
    }

    .comments-section .cmt-composer-field textarea {
        /* 16px — иначе iOS Safari увеличивает страницу при фокусе */
        font-size: 16px;
        padding: 10px 44px 10px 12px;
    }

    /* Панель смайликов на узком экране — в public/css/emoji.css */
}

/* ==========================================================================
   Прикрепление картинок к комментарию
   ========================================================================== */
.comments-section .cmt-attach {
    position: absolute;
    right: 52px;
    bottom: 10px;
}

.comments-section .cmt-attach-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    background: #f4f6fb;
    color: #6b7394;
    border: 1px solid #e3e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.comments-section .cmt-attach-btn:hover {
    background: #eef0ff;
    color: #3d439b;
    border-color: #dcdff7;
}

.comments-section .cmt-attach-btn svg {
    width: 18px;
    height: 18px;
}

/* Превью выбранных фото */
.comments-section .cmt-attach-preview {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    background: #f7f9fc;
    border: 1px solid #edf0f6;
    border-radius: 12px;
}

.comments-section .cmt-attach-preview::-webkit-scrollbar {
    display: none;
}

.comments-section .cmt-attach-item {
    position: relative;
    flex: 0 0 auto;
    width: 72px;
    height: 72px;
    border-radius: 10px;
    overflow: hidden;
    background: #e9ecf3;
}

.comments-section .cmt-attach-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.comments-section .cmt-attach-item.is-uploading img {
    opacity: 0.55;
}

.comments-section .cmt-attach-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    background: rgba(23, 32, 56, 0.75);
    color: #fff;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}

.comments-section .cmt-attach-remove svg {
    width: 12px;
    height: 12px;
}

.comments-section .cmt-attach-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-top-color: #3d439b;
    border-radius: 50%;
    animation: cmtAttachSpin 0.8s linear infinite;
}

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

/* Картинки внутри комментария */
.comments-section .cmt-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr));
    /* Плитки выравниваются по верху: у фоток разные пропорции,
       и подгонять их под общую высоту не нужно. */
    align-items: start;
    gap: 8px;
    margin-top: 10px;
    width: 100%;
    max-width: 520px;
    min-width: 0;
}

.comments-section .cmt-image {
    display: block;
    border-radius: 10px;
    overflow: hidden;
    background: #e9ecf3;
    line-height: 0;
}

.comments-section .cmt-image img {
    display: block;
    /* Фото показывается целиком, без обрезки и растяжения:
       ширина фиксируется колонкой, высота — по пропорциям снимка. */
    width: 100%;
    height: auto;
    max-height: 320px;
    object-fit: cover;
}

/* Просмотр картинки во весь экран */
.cmt-lightbox {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(10, 14, 26, 0.92);
}

.cmt-lightbox[hidden] {
    display: none;
}

.cmt-lightbox img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.cmt-lightbox-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 42px;
    height: 42px;
    font-size: 26px;
    line-height: 1;
    color: #fff;
    background: rgba(255, 255, 255, 0.16);
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}
/* ==========================================================================
   Прикрепление картинок: удобство на телефоне и планшете
   ========================================================================== */
@media (max-width: 1000px) {
    /* Кнопка скрепки — крупная, попадает пальцем */
    .comments-section .cmt-attach {
        right: 56px;
        bottom: 12px;
    }

    .comments-section .cmt-attach-btn {
        width: 40px;
        height: 40px;
        border-radius: 12px;
    }

    .comments-section .cmt-attach-btn svg {
        width: 20px;
        height: 20px;
    }

    /* Текст не заезжает под кнопки */
    .comments-section .cmt-composer-field textarea {
        padding-right: 96px;
    }
}

@media (max-width: 640px) {
    .comments-section .cmt-attach-item {
        width: 64px;
        height: 64px;
    }

    .comments-section .cmt-attach-remove {
        width: 26px;
        height: 26px;
    }

    .comments-section .cmt-attach-remove svg {
        width: 14px;
        height: 14px;
    }

    /* Картинки в комментарии — по ширине экрана */
    .comments-section .cmt-images {
        grid-template-columns: repeat(auto-fill, minmax(min(120px, 100%), 1fr));
        max-width: 100%;
        gap: 6px;
    }
}