
@media (max-width: 767px) {
  html, body {
    height: 100%;
  }

  body {
    display: flex;
    flex-direction: column;
  }

  #page-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.authenticated #page-content {
    padding-bottom: calc(140px + env(safe-area-inset-bottom));
  }

  body.overflow-hidden #page-content {
    overflow: hidden;
  }

  /* Wave show page: video pinned at top, content scrolls below */
  body.wave-page #page-content {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
  }

  body.wave-page #wavePageWrapper {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  body.wave-page #playerContainer {
    flex-shrink: 0;
    background: #000;
    padding-top: env(safe-area-inset-top);
  }

  body.wave-page #waveContent {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.authenticated.wave-page #waveContent {
    padding-bottom: calc(140px + env(safe-area-inset-bottom)) !important;
  }
}

body {
    background: #fafafa;
    touch-action: manipulation;
    overscroll-behavior-x: none;
    -webkit-user-select: none;
    user-select: none;
}

input, textarea, [contenteditable] {
    -webkit-user-select: text;
    user-select: text;
}

hr {
    opacity: 0.1;
}

.spot-map iframe {
    display: block;
    border-radius: 0 !important; /* overflow-hidden на карточке клипает углы */
}

.label-xs {
    font-size: 0.65rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--bs-secondary-color);
}

.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 9999;
    opacity: 0;
    overflow: hidden;
    transition: opacity 0.2s ease;
    cursor: zoom-out;
}

.lightbox-overlay.active {
    opacity: 1;
}

.lightbox-img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    cursor: default;
    /* Hint compositor to promote to its own layer — avoids repaint on every transform */
    will-change: transform;
}

.lightbox-counter {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    background: rgba(0, 0, 0, 0.55);
    padding: 3px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    pointer-events: none;
    white-space: nowrap;
}

.wave-divider {
    display: block;
    width: 100%;
    height: 20px;
    color: #a8c8e8;
    margin: 0.5rem 0;
    opacity: 0.3;
}

@media (max-width: 767px) {
    .wave-card .video-card {
        aspect-ratio: 4 / 3;
    }
}

.wave-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    padding-top: 2.5rem;
    background: linear-gradient(transparent, rgba(0,0,0,0.72));
}

/* Player buttons */
.player-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
    padding: 0;
}

.player-btn:hover, .player-btn:focus {
    background: rgba(255,255,255,0.28);
    outline: none;
}

.player-btn--play {
    width: 46px;
    height: 46px;
    font-size: 22px;
    background: rgba(255,255,255,0.92);
    color: #111;
}

.player-btn--play:hover {
    background: #fff;
    color: #000;
}

.player-btn--sm {
    width: 32px;
    height: 32px;
    font-size: 15px;
    background: rgba(255,255,255,0.1);
}

.player-btn--sm:hover {
    background: rgba(255,255,255,0.22);
}

.player-speed-btn {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: none;
    border-radius: 20px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    padding: 5px 14px;
    cursor: pointer;
    transition: background 0.15s;
}

.player-speed-btn:hover {
    background: rgba(255,255,255,0.25);
}

@media (max-width: 767px) {
    .player-btn { width: 30px; height: 30px; font-size: 14px; }
    .player-btn--play { width: 38px; height: 38px; font-size: 17px; }
    .player-btn--sm { width: 26px; height: 26px; font-size: 12px; }
    .player-speed-btn { font-size: 11px; padding: 4px 10px; }
}

#playerContainer:fullscreen .player-btn,
#playerContainer:-webkit-full-screen .player-btn,
#playerContainer.player-fullscreen .player-btn { width: 38px; height: 38px; font-size: 18px; }

#playerContainer:fullscreen .player-btn--play,
#playerContainer:-webkit-full-screen .player-btn--play,
#playerContainer.player-fullscreen .player-btn--play { width: 46px; height: 46px; font-size: 22px; }

#playerContainer:fullscreen .player-btn--sm,
#playerContainer:-webkit-full-screen .player-btn--sm,
#playerContainer.player-fullscreen .player-btn--sm { width: 32px; height: 32px; font-size: 15px; }

#playerContainer:fullscreen .player-speed-btn,
#playerContainer:-webkit-full-screen .player-speed-btn,
#playerContainer.player-fullscreen .player-speed-btn { font-size: 13px; padding: 5px 14px; }

/* Timeline */
.wave-timeline {
    position: relative;
    width: 100%;
    height: 20px;
    cursor: pointer;
}

.wave-timeline::before {
    content: '';
    position: absolute;
    left: 0; right: 0;
    top: 50%;
    height: 4px;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.25);
    border-radius: 2px;
}

.wave-timeline__buffered {
    position: absolute;
    top: 50%;
    left: 0;
    height: 4px;
    transform: translateY(-50%);
    width: 0;
    background: rgba(255,255,255,0.35);
    border-radius: 2px;
}

.wave-timeline__progress {
    position: absolute;
    top: 50%;
    left: 0;
    height: 4px;
    transform: translateY(-50%);
    width: 0;
    background: #fff;
    border-radius: 2px;
}

.wave-timeline__thumb {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.35);
    pointer-events: none;
    transition: transform 0.1s;
}

.wave-timeline:active .wave-timeline__thumb {
    transform: translate(-50%, -50%) scale(1.3);
}

.wave-marker {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: stretch;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 6px;
    overflow: hidden;
    pointer-events: auto;
    z-index: 2;
}

.wave-marker__seek {
    padding: 0 9px;
    height: 28px;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.05em;
    min-width: 28px;
}

.wave-marker__delete {
    width: 30px;
    height: 28px;
    border: none;
    border-left: 1px solid rgba(255,255,255,0.15);
    background: transparent;
    color: rgba(255,255,255,0.55);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.wave-marker__seek:active  { background: rgba(255,255,255,0.12); }
.wave-marker__delete:active { background: rgba(255,255,255,0.12); color: #fff; }

.wave-time {
    font-size: 11px;
    color: rgba(255,255,255,0.8);
    font-weight: 500;
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
}

/* Drawing tools */
.drawing-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: rgba(255,255,255,0.85);
    font-size: 15px;
    cursor: pointer;
    transition: background 0.15s;
    padding: 0;
}

.drawing-btn:hover {
    background: rgba(0,0,0,0.6);
    color: #fff;
}

.drawing-btn--active {
    background: rgba(255,255,255,0.92) !important;
    color: #111 !important;
}

.drawing-btn--danger {
    background: rgba(200,40,40,0.45);
}

.drawing-btn--danger:hover {
    background: rgba(200,40,40,0.7);
}

.drawing-tool-group {
    display: flex;
    gap: 2px;
    background: rgba(0,0,0,0.2);
    border-radius: 10px;
    padding: 2px;
}

.drawing-color-picker {
    width: 32px;
    height: 32px;
    border: 4px solid #fff;
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
    outline: none;
    overflow: hidden;
    -webkit-appearance: none;
    appearance: none;
    background: none;

}

.drawing-color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}

.drawing-color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 6px;
}

.drawing-color-picker::-moz-color-swatch {
    border: none;
    border-radius: 6px;
}

.card {
    background: #fff;
}

header a {
    text-decoration: none !important;
}

#brand-name {
    display: block;
    text-decoration: none;
    color: inherit;
}

.path-block {
    margin-top: 40px;
}

.path-title {
    margin-bottom: 8px;
}

.path-subtitle {
    color: #666;
    margin-bottom: 16px;
}

.path-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.path-list li {
    margin: 4px 0;
}

.path-list .arrow {
    color: #999;
}

.path-list .hint {
    margin-left: 8px;
    color: #999;
    font-weight: normal;
}

.path-cta-text {
    margin-top: 24px;
    margin-bottom: 8px;
}

.signup-info {
    opacity: 0.6;
    margin-bottom: 16px;
}

.signup-info ul {
    padding-left: 18px;
}

.signup-footer {
    margin-top: 24px;
}

.login-footer {
    margin-top: 16px;
}

.password-reset-subtitle {
    opacity: 0.6;
    margin-bottom: 16px;
}

.auth-links p {
    margin-bottom: 8px;
}

.auth-links a {
    text-decoration: none;
}

.auth-links a:hover {
    text-decoration: underline;
}

.progress-text {
    position: absolute;
    width: 100%;
    text-align: center;
    color: #fff;
}

.task.done {
    text-decoration: line-through;
    opacity: 0.5;
}

.waiting-block {
    opacity: 0.7;
    font-size: 14px;
}

.done {
    text-decoration: line-through;
    opacity: 0.5;
}

.upload-subtitle {
    opacity: 0.7;
    margin-bottom: 12px;
}

.upload-rules {
    margin-bottom: 16px;
}

.upload-rules ul {
    padding-left: 18px;
}

.review-video {
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

h1 {
    font-weight: 700;
    font-size: 36px;
}

h1, h2, h3 {
    color: #333;
    line-height: 1.1;
    letter-spacing: -0.04em;
}

p {
    font-weight: 400;
    opacity: 0.85;
}

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

.btn:hover {
    filter: brightness(1.05);
}

.hero-cta {
    box-shadow: 0 12px 30px rgba(255, 193, 7, 0.5);
}

.flash-container {
    position: fixed;
    top: 20px;
    left: 0;
    width: 100%;
    z-index: 9999;
    display: flex;
    justify-content: center;
    pointer-events: none;
}

.flash-container .alert {
    pointer-events: auto;
    width: 90%;
    max-width: 600px;
}

@media (min-width: 992px) {
    .flash-container {
        justify-content: flex-end;
        padding-right: 20px;
    }

    .flash-container .alert {
        width: auto;
        min-width: 300px;
        max-width: 400px;
    }
}

.container {
    max-width: 1140px;
}

.canvas-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 0;
    overflow: hidden;
}

@media (min-width: 768px) {
    .canvas-wrapper {
        border-radius: var(--bs-border-radius-xxl);
    }
}

#zoomLayer {
    position: absolute;
    inset: 0;
    transform-origin: center center;
    will-change: transform;
}

#videoPoster {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.canvas-wrapper canvas,
.canvas-wrapper video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

#video {
    background: #000;
    border-radius: 0;
}

@media (min-width: 768px) {
    #video {
        border-radius: inherit;
    }
}

.card {
    border: 0;
    box-shadow: 0 2px 10px 0 rgba(0,0,0,.06);
}

.card iframe {
    width: 100% !important;
    border-radius: var(--bs-border-radius-xxl);
    height: 100% !important;
}

.rounded-end {
    --bs-border-radius: 0;
}

.video-card {
    width: 100%;
    aspect-ratio: 16 / 9;
    position: relative;
    overflow: hidden;
    background: linear-gradient(90deg, #e8e8e8 25%, #f5f5f5 50%, #e8e8e8 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.4s ease-in-out infinite;
}

.video-card:has(img.loaded) {
    animation: none;
    background: #1a1a1a;
}

.video-card--processing {
    animation: none;
    background: #efefef;
}

@keyframes skeleton-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.video-card .time {
    position: absolute;
    right: 10px;
    bottom: 10px;
    color: #fff;
    background: rgba(0,0,0,.6);
    padding: 0px 5px;
    font-size: 80%;
}

.video-card img,
.video-card video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-card img.video-poster {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.video-card img.video-poster.loaded {
    opacity: 1;
}

.play-btn {
    position: absolute;
    color: #fff;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.play-btn:hover {
    color: #fff;
    opacity: 0.8;
}

.spinner-border {
    --bs-spinner-border-width: 0.1rem;
    color: #fff;
    position: absolute;
    left: calc(50% - 15px);
    top: calc(50% - 17px);
}

.translation_missing {
    color: red;
}

.mascot-wrapper {
    position: relative;
    display: inline-block;
}

.mascot-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    border: 6px solid #f5a623;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.mascot-bubble {
    position: absolute;
    top: 10px;
    right: 120px;
    background: white;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    min-width: 210px;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.mascot-bubble::after {
    content: "";
    position: absolute;
    bottom: 0px;
    right: -8px;
    width: 0;
    height: 0;
    transform: rotate(70deg);
    rotate: 70deg;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid white;
}

.w-fit { width: fit-content !important; }

.wave-card .status {
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    display: inline-block;
    width: 100%;
    cursor: default;
}

.text-decoration-none * {
    text-decoration: none !important;
}

.captain {
    position: relative;
}

.captain::after {
    content: "";
    position: absolute;
    top: -4px;
    right: -4px;
    width: 12px;
    height: 12px;
    background: gold;
    clip-path: polygon(
        50% 0%,
        61% 35%,
        98% 35%,
        68% 57%,
        79% 91%,
        50% 70%,
        21% 91%,
        32% 57%,
        2% 35%,
        39% 35%
    );
}

/* Native fullscreen — flex даёт canvas-wrapper надёжную высоту */
#playerContainer:fullscreen,
#playerContainer:-webkit-full-screen {
    background: #000;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
}

#playerContainer:fullscreen .canvas-wrapper,
#playerContainer:-webkit-full-screen .canvas-wrapper {
    flex: 1 !important;
    min-height: 0 !important;
    aspect-ratio: unset !important;
    border-radius: 0 !important;
    margin: 0 !important;
    background: #000;
}

/* Custom fullscreen (iOS Safari + fallback) */
#playerContainer.player-fullscreen {
    position: fixed !important;
    inset: 0 !important;
    z-index: 9998 !important;
    background: #000 !important;
    padding: 0 !important;
    margin: 0 !important;
}

#playerContainer.player-fullscreen .canvas-wrapper {
    aspect-ratio: unset !important;
    height: 100% !important;
    border-radius: 0 !important;
    margin: 0 !important;
    background: #000;
}

/* Shared */
#playerContainer:fullscreen #video,
#playerContainer:-webkit-full-screen #video,
#playerContainer.player-fullscreen #video {
    object-fit: contain !important;
    border-radius: 0 !important;
}

#playerContainer:fullscreen .wave-controls,
#playerContainer:-webkit-full-screen .wave-controls,
#playerContainer.player-fullscreen .wave-controls {
    background: rgba(0, 0, 0, 0.75);
    padding-top: 0.5rem;
}

.event-card__badges {
    position: absolute;
    top: -4px;
    left: 0;
    z-index: 5;
    display: flex;
    gap: 6px;
    font-size: 80%;
}

/* Chat */
.chat-layout {
  display: flex;
  height: calc(100vh - 57px);
  height: calc(100dvh - 57px);
  overflow: hidden;
  overscroll-behavior: none;
}

.chat-sidebar {
  width: 240px;
  min-width: 240px;
  border-right: 1px solid #dee2e6;
  background: #fff;
}

.chat-sidebar__room {
  color: #212529;
  border-radius: 6px;
  margin: 4px 8px;
  padding: 8px 12px !important;
}
.chat-sidebar__room:hover { background: #f8f9fa; }
.chat-sidebar__room.active { background: #e7f1fd; color: #1a78c2; }

.chat-main__header {
  position: relative;
  flex-shrink: 0;
  height: 57px;
  background: #fff;
  box-shadow: 0 2px 10px 0 rgba(0,0,0,.06);
  z-index: 1;
}

.chat-main {
  min-height: 0;
  background: #fafafa;
  position: relative;
}

.chat-messages {
  display: flex;
  flex-direction: column;
}
.chat-messages::after {
  content: "";
  display: block;
  min-height: 90px;
  flex-shrink: 0;
}

.chat-jump-btn {
  position: absolute;
  bottom: 110px;
  right: 20px;
  z-index: 10;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  color: #555;
}
.chat-input {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 16px 32px;
}
.chat-input__bubble {
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 24px;
  padding: 6px 6px 6px 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
}

/* On mobile: fixed positioning avoids dvh reflows when the keyboard opens/closes */
@media (max-width: 767px) {
  .chat-layout {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 70px; /* bottom nav height */
    height: auto;
  }
}

/* Message bubble */
.chat-message__bubble {
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  padding: 6px 12px;
  max-width: 75%;
}
.chat-message--own .chat-message__bubble {
  background: #e7f1fd;
  border-color: #c5dcf5;
}
.chat-message--own {
  flex-direction: row-reverse;
}
.chat-message--own .chat-message__name {
  display: none;
}
.chat-message--own .chat-message__meta {
  justify-content: flex-end;
}
.chat-message--own .chat-message__body {
  text-align: right;
}
.chat-message__meta {
  display: flex;
  gap: 6px;
  align-items: baseline;
  margin-bottom: 2px;
}
.chat-message__body {
  font-size: 0.9rem;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
.chat-message__body a {
  color: #1a78c2;
  text-decoration: underline;
  word-break: break-all;
}
.chat-message--own .chat-message__body a {
  color: #1a78c2;
}
.chat-message__body--deleted {
  font-style: italic;
  opacity: 0.45;
  white-space: normal;
}
.chat-message__footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  margin-top: 3px;
  min-height: 16px;
}
.chat-message__time {
  font-size: 11px;
  color: #adb5bd;
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
}

/* ── Reaction picker popup ───────────────────────────────────────────── */
.reaction-picker {
  position: fixed;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .16), 0 1px 4px rgba(0, 0, 0, .08);
  /* Animate in */
  animation: reaction-picker-in 0.15s ease-out;
}
.reaction-picker__row {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 10px;
}
.reaction-picker__actions {
  border-top: 1px solid #e0e0e0;
  padding: 4px 10px;
  justify-content: center;
}
@keyframes reaction-picker-in {
  from { opacity: 0; transform: scale(0.85) translateY(4px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);   }
}
.reaction-picker[hidden] {
  display: none;
}
.reaction-picker__btn {
  background: none;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 5px;
  border-radius: 10px;
  transition: transform 0.12s, background 0.12s;
}
.reaction-picker__btn:hover,
.reaction-picker__btn:focus-visible {
  background: #f0f0f0;
  transform: scale(1.25);
  outline: none;
}
.reaction-picker__btn:active {
  transform: scale(1.1);
}

/* Long-press visual feedback on the bubble */
.reaction-picker-pressed {
  opacity: 0.65;
  transform: scale(0.97);
  transition: opacity 0.05s, transform 0.05s;
}

/* ── Reaction badges under message ───────────────────────────────────── */
.chat-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}
.chat-reaction {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #f0f2f5;
  border: 1.5px solid transparent;
  border-radius: 10px;
  padding: 2px 7px 2px 5px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s, transform 0.1s;
}
.chat-reaction:hover {
  background: #e4e6ea;
  transform: scale(1.06);
}
.chat-reaction:active {
  transform: scale(0.96);
}
.chat-reaction--mine {
  background: #e7f1fd;
  border-color: #9dc4ef;
}
.chat-reaction--mine:hover {
  background: #d9eafb;
}
.chat-reaction__emoji {
  font-size: 0.95rem;
  line-height: 1;
}
.chat-reaction__count {
  font-size: 0.75rem;
  font-weight: 600;
  color: #444;
  line-height: 1;
}

/* ── Reaction picker: separator + action buttons (reply, edit) ───────── */
.reaction-picker__sep {
  width: 1px;
  background: #e0e0e0;
  margin: 4px 4px;
  align-self: stretch;
  flex-shrink: 0;
}
.reaction-picker__action-btn {
  background: none;
  border: none;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 10px;
  color: #555;
  transition: background 0.12s, color 0.12s;
  display: flex;
  align-items: center;
}
.reaction-picker__action-btn:hover,
.reaction-picker__action-btn:focus-visible {
  background: #f0f0f0;
  color: #1a78c2;
  outline: none;
}
.reaction-picker__action-btn--danger {
  color: #c0392b;
}
.reaction-picker__action-btn--danger:hover,
.reaction-picker__action-btn--danger:focus-visible {
  background: #fdecea;
  color: #c0392b;
}

/* ── Inline message editor ───────────────────────────────────────────── */

/* ── "ред." edited indicator ─────────────────────────────────────────── */
.chat-message__edited {
  font-size: 10px;
  color: #b0bec5;
  margin-right: 2px;
}

/* ── Reply quote block inside message bubble ─────────────────────────── */
.chat-reply-quote {
  position: relative;
  display: flex;
  gap: 8px;
  align-items: stretch;
  background: rgba(26, 120, 194, 0.09);
  border-radius: 8px;
  padding: 5px 8px 5px 10px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: background 0.12s;
  overflow: hidden;
  text-decoration: none;
}
/* Vertical accent bar */
.chat-reply-quote::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #1a78c2;
  border-radius: 3px 0 0 3px;
}
.chat-reply-quote:hover {
  background: rgba(26, 120, 194, 0.16);
}
.chat-reply-quote__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.chat-reply-quote__name {
  font-size: 0.78rem;
  font-weight: 700;
  color: #1a78c2;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-reply-quote__text {
  font-size: 0.82rem;
  color: #555;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}
/* Own messages: slightly adjusted palette */
.chat-message--own .chat-reply-quote {
  background: rgba(10, 80, 150, 0.12);
}
.chat-message--own .chat-reply-quote::before {
  background: #0a5096;
}
.chat-message--own .chat-reply-quote__name {
  color: #0a5096;
}
.chat-message--own .chat-reply-quote__text {
  color: #3a5a7a;
}

/* ── Reply bar above the input ───────────────────────────────────────── */
.chat-reply-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 14px;
  background: #f0f6ff;
  border-top: 1px solid #d0e4f7;
  border-radius: 16px 16px 0 0;
  margin-bottom: -1px;
}
.chat-reply-bar__icon {
  color: #1a78c2;
  font-size: 1rem;
  flex-shrink: 0;
}
.chat-reply-bar__content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.chat-reply-bar__name {
  font-size: 0.75rem;
  font-weight: 600;
  color: #1a78c2;
  line-height: 1.2;
}
.chat-reply-bar__text {
  font-size: 0.78rem;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.chat-reply-bar__close {
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  padding: 2px 4px;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  border-radius: 4px;
  flex-shrink: 0;
  transition: color 0.1s, background 0.1s;
}
.chat-reply-bar__close:hover {
  color: #333;
  background: #e0edf8;
}

/* ── Highlight animation on scroll-to ───────────────────────────────── */
@keyframes chat-highlight-pulse {
  0%   { background: rgba(255, 220, 60, 0.55); }
  70%  { background: rgba(255, 220, 60, 0.25); }
  100% { background: transparent; }
}
.chat-message--highlighted .chat-message__bubble {
  animation: chat-highlight-pulse 2s ease-out forwards;
  border-radius: 12px;
}

/* ── Chat image grid (in message bubble) ─────────────────────── */
.chat-message__images {
  display: grid;
  gap: 3px;
  margin-bottom: 4px;
  border-radius: 10px;
  overflow: hidden;
}
/* 1 photo — content-sized, up to 260px */
.chat-message__images--1 {
  grid-template-columns: 1fr;
  max-width: 260px;
}
/* 2 photos — side by side, fixed width so grid has definite size */
.chat-message__images--2 {
  grid-template-columns: 1fr 1fr;
  width: 240px;
  max-width: 100%;
}
/* 3 photos */
.chat-message__images--3 {
  grid-template-columns: 1fr 1fr 1fr;
  width: 280px;
  max-width: 100%;
}
/* 4 photos — 2×2 */
.chat-message__images--4 {
  grid-template-columns: 1fr 1fr;
  width: 240px;
  max-width: 100%;
}
/* 5+ — 3 cols.
   Base is 6 virtual columns so fractional last rows can be expressed
   with integer spans: each cell = span 2 (= 1/3 width), last-row
   orphans get span 3 (= 1/2) or span 6 (= full width). */
.chat-message__images--5 {
  grid-template-columns: repeat(6, 1fr);
  width: 280px;
  max-width: 100%;
}
.chat-message__images--5 .chat-message__image-item {
  grid-column: span 2;
}
/* 1 orphan on last row (positions 1, 4, 7, 10 …) → full width */
.chat-message__images--5 .chat-message__image-item:last-child:nth-child(3n+1) {
  grid-column: 1 / -1;
}
/* 2 orphans on last row: the first orphan (positions 4, 7 …) */
.chat-message__images--5 .chat-message__image-item:nth-last-child(2):nth-child(3n+1) {
  grid-column: span 3;
}
/* 2 orphans on last row: the second orphan (positions 5, 8 …) */
.chat-message__images--5 .chat-message__image-item:last-child:nth-child(3n+2) {
  grid-column: span 3;
}
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.chat-message__image-item {
  overflow: hidden;
  line-height: 0;
  /* skeleton by default */
  min-height: 120px;
  background: linear-gradient(90deg,
    var(--bs-secondary-bg, #e8e8e8) 25%,
    var(--bs-tertiary-bg,  #f0f0f0) 50%,
    var(--bs-secondary-bg, #e8e8e8) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
}
/* single-image: needs explicit min-width so skeleton is visible before dimensions are known */
.chat-message__images--1 .chat-message__image-item:not(.loaded) {
  min-height: 160px;
  min-width: 180px;
}
.chat-message__image-item.loaded {
  background: none;
  animation: none;
  min-height: unset;
  min-width: unset;
}
.chat-img {
  display: block;
  width: 100%;
  height: 120px;
  object-fit: cover;
  cursor: zoom-in;
  /* starts invisible; fades in once loaded */
  opacity: 0;
  transition: opacity .2s ease;
}
.chat-message__image-item.loaded .chat-img {
  opacity: 1;
}
.chat-message__images--1 .chat-img {
  height: auto;
  max-height: 320px;
  width: auto;
  max-width: 100%;
}
.chat-img:hover {
  opacity: .9;
}

/* ── Image preview bar (above input) ─────────────────────────── */
.chat-image-preview-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bs-body-bg, #fff);
  border-top: 1px solid rgba(0,0,0,.08);
}
.chat-image-preview-bar__list {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  flex: 1;
  min-width: 0;
  scrollbar-width: none;
}
.chat-image-preview-bar__list::-webkit-scrollbar { display: none; }
.chat-image-preview-bar__thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}
.chat-image-preview-bar__remove {
  background: none;
  border: none;
  padding: 4px;
  line-height: 1;
  color: var(--bs-secondary);
  cursor: pointer;
  flex-shrink: 0;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
}
.chat-image-preview-bar__remove:hover {
  color: var(--bs-danger);
}
