/* Просмотр фото, видео и аудио — макет «Веб: просмотр» (WebMedia и
   WebMediaPhone). Цвета и размеры оттуда, поэтому здесь числа, а не
   переменные палитры: окно всегда тёмное, какая бы палитра ни стояла. */

.mv {
  position: fixed; inset: 0; z-index: 40;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  grid-template-rows: 68px minmax(0, 1fr) auto 108px;
  grid-template-areas: "head head" "stage info" "controls info" "thumbs thumbs";
  column-gap: 20px;
  padding: 0 24px;
  background: #05080F; color: #EAF0FB;
  font-family: "Golos Text", -apple-system, BlinkMacSystemFont, sans-serif;
  animation: mv-in 200ms ease both;
}
@keyframes mv-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes mv-toast { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

.mv:focus { outline: none; }
.mv button { font: inherit; color: inherit; cursor: pointer; }
.mv .icon { width: 20px; height: 20px; vertical-align: 0; }
.mv-phone { display: none !important; }

/* ---------- Шапка ---------- */

.mv-head { grid-area: head; display: flex; align-items: center; gap: 10px; min-width: 0; }
.mv-round {
  position: relative; flex: none; width: 40px; height: 40px; padding: 0;
  display: grid; place-items: center;
  border: 0; border-radius: 20px; background: #1D2944; color: #EAF0FB;
}
.mv-round:disabled { opacity: 0.3; pointer-events: none; }
.mv-head .mv-round:first-child .icon, .mv-head [aria-label="Поделиться"] .icon { width: 18px; height: 18px; }
.mv-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mv-who, .mv-name {
  font-size: 15px; line-height: 20px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mv-count { font-size: 12px; line-height: 16px; color: #9DAAC4; font-variant-numeric: tabular-nums; }
.mv-save {
  flex: none; height: 40px; padding: 0 16px 0 12px;
  display: flex; align-items: center; gap: 6px;
  border: 0; border-radius: 20px; background: #5E9BFF; color: #0B1120 !important;
  font-size: 14px !important; font-weight: 600;
}
.mv-save .icon { width: 18px; height: 18px; }

/* ---------- Сцена ---------- */

.mv-stage { grid-area: stage; position: relative; min-height: 0; border-radius: 18px; overflow: hidden; background: #000; }

.mv-photo {
  position: absolute; inset: 0; padding: 0; border: 0; overflow: hidden;
  background: #000; cursor: zoom-in !important; touch-action: pan-y;
}
.mv-photo.zoomed { cursor: grab !important; touch-action: none; }
.mv-zoom { width: 100%; height: 100%; transition: transform 450ms cubic-bezier(0.2, 0.9, 0.3, 1.05); }
.mv-zoom.dragging { transition: none; }
.mv-picture { display: block; width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.mv-picture.missing { visibility: hidden; }

.mv-videobox { position: absolute; inset: 0; background: #000; }
.mv-video { display: block; width: 100%; height: 100%; object-fit: contain; }
.mv-surface { position: absolute; inset: 0; padding: 0; border: 0; background: none; }
.mv-center {
  position: absolute; left: 50%; top: 50%; width: 76px; height: 76px; margin: -38px 0 0 -38px; padding: 0;
  border: 0; border-radius: 38px; background: rgba(40, 48, 70, 0.7); color: #FFFFFF !important;
  transition: opacity 250ms ease;
}
.mv-center .icon { width: 30px; height: 30px; }
.mv-center .mv-ic.replay .icon { width: 28px; height: 28px; }
.mv[data-media="playing"] .mv-center { opacity: 0; pointer-events: none; }

/* Кнопка воспроизведения: значок «играть», «пауза» или «ещё раз» по состоянию плеера. */
.mv-ic { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; transition: opacity 200ms ease; }
.mv-ic.play, .mv-ic.sound { opacity: 1; }
.mv[data-media="playing"] .mv-ic.play { opacity: 0; }
.mv[data-media="playing"] .mv-ic.pause { opacity: 1; }
.mv[data-media="ended"] .mv-ic.play { opacity: 0; }
.mv[data-media="ended"] .mv-ic.replay { opacity: 1; }
.muted .mv-ic.sound { opacity: 0; }
.muted .mv-ic.mute { opacity: 1; }

.mv-error {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; background: #0B1120; color: #9DAAC4; font-size: 15px;
}

/* ---------- Плеер видео ---------- */

.mv-controls { grid-area: controls; margin-top: 14px; min-width: 0; }
.mv-vbar { display: flex; align-items: center; gap: 12px; }
.mv-play {
  position: relative; flex: none; padding: 0; border: 0; border-radius: 22px;
  width: 44px; height: 44px; background: #5E9BFF; color: #0B1120 !important;
}
.mv-play.large { width: 52px; height: 52px; border-radius: 26px; }
.mv-play.huge { width: 72px; height: 72px; border-radius: 36px; }
.mv-play.huge .icon { width: 30px; height: 30px; }
.mv-round.big { width: 52px; height: 52px; border-radius: 26px; }
.mv-round.big .icon { width: 24px; height: 24px; }
.mv-cur { width: 40px; font-size: 13px; color: #C9D2E3; font-variant-numeric: tabular-nums; }
.mv-left { width: 44px; text-align: right; font-size: 13px; color: #9DAAC4; font-variant-numeric: tabular-nums; }
.mv-scrub { position: relative; flex: 1; min-width: 0; height: 44px; cursor: pointer; touch-action: none; border-radius: 4px; }
.mv-track, .mv-fill { position: absolute; left: 0; top: 20px; height: 4px; border-radius: 2px; }
.mv-track { right: 0; background: rgba(255, 255, 255, 0.2); }
.mv-fill { width: 0; background: #FFFFFF; transition: width 250ms linear; }
.mv-knob {
  position: absolute; left: 0; top: 15px; width: 14px; height: 14px; margin-left: -7px;
  border-radius: 7px; background: #FFFFFF; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4); transition: left 250ms linear;
}
.mv-scrub[data-dragging] .mv-fill, .mv-scrub[data-dragging] .mv-knob { transition: none; }

.mv-pill {
  flex: none; height: 36px; padding: 0 14px 0 11px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 18px; background: #1D2944; color: #EAF0FB;
  font-size: 14px !important; font-weight: 600; white-space: nowrap;
  transition: background-color 200ms ease, color 200ms ease;
}
.mv-pill .icon { width: 16px; height: 16px; }
.mv-pill[aria-pressed="true"] { background: #5E9BFF; color: #0B1120; }
.mv-vbar .mv-pill[data-speed] { min-width: 60px; padding: 0 12px; }

/* ---------- Плеер аудио ---------- */

.mv-audio {
  position: absolute; inset: 0; box-sizing: border-box; padding: 20px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px;
  background: radial-gradient(120% 90% at 50% 0%, #1D2944 0%, #0B1120 70%);
}
.mv-akicker { font-size: 13px; line-height: 18px; font-weight: 600; color: #8DB8FF; }
.mv-atitle {
  font-family: "Onest", "Golos Text", sans-serif; font-size: 34px; line-height: 40px; font-weight: 600;
  text-align: center; overflow-wrap: anywhere;
}
.mv-asub { font-size: 16px; line-height: 20px; font-weight: 600; color: #F2C46D; text-align: center; overflow-wrap: anywhere; }
.mv-wave {
  position: relative; width: 630px; max-width: 100%; height: 96px;
  overflow: hidden; cursor: pointer; touch-action: none; container-type: inline-size;
}
.mv-bars { position: absolute; inset: 0; display: flex; align-items: center; gap: 3px; }
.mv-bars span { flex: none; width: 4px; border-radius: 2px; background: rgba(157, 170, 196, 0.32); }
.mv-bars.played span { background: #5E9BFF; }
.mv-played { position: absolute; left: 0; top: 0; bottom: 0; width: 0; overflow: hidden; transition: width 300ms linear; }
.mv-played .mv-bars { right: auto; width: 100cqw; }
.mv-wave[data-dragging] .mv-played { transition: none; }
.mv-atime { display: flex; gap: 12px; font-size: 13px; color: #C9D2E3; font-variant-numeric: tabular-nums; }
.mv-atime .slash { color: #6F7D99; }
.mv-atime .total { color: #9DAAC4; }
.mv-abtns { display: flex; align-items: center; gap: 24px; }

/* ---------- Запись справа ---------- */

.mv-info {
  grid-area: info; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 14px;
  padding: 18px; border-radius: 22px; background: #131C31;
}
.mv-author { display: flex; align-items: center; gap: 12px; }
.mv-meta { font-size: 13px; line-height: 18px; color: #9DAAC4; }
.mv-caption { margin: 0; font-size: 15px; line-height: 21px; white-space: pre-line; overflow-wrap: anywhere; }
.mv-item { font-size: 13px; line-height: 18px; font-weight: 600; color: #F2C46D; overflow-wrap: anywhere; }
.mv-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.mv-speedrow { display: flex; align-items: center; justify-content: space-between; }
.mv-speedrow > span { font-size: 13px; line-height: 18px; font-weight: 600; color: #9DAAC4; }
.mv-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.mv-chip {
  height: 36px; padding: 0 12px; display: flex; align-items: center; gap: 6px;
  border: 0; border-radius: 18px; background: #1D2944; color: #EAF0FB; font-size: 14px;
}
.mv-chip.link { padding: 0 14px 0 11px; }
.mv-chip .icon { width: 16px; height: 16px; }
.mv-keys { margin-top: auto; font-size: 12px; line-height: 16px; color: #6F7D99; }

/* ---------- Миниатюры ---------- */

.mv-thumbs {
  grid-area: thumbs; display: flex; align-items: center; justify-content: center; gap: 10px;
  min-width: 0; overflow-x: auto; scrollbar-width: none;
}
.mv-thumbs::-webkit-scrollbar { display: none; }
.mv-thumb {
  position: relative; flex: none; width: 96px; height: 72px; padding: 0; overflow: hidden;
  border: 0; border-radius: 12px; background: #000;
  box-shadow: 0 0 0 2px rgba(157, 170, 196, 0); opacity: 0.6;
  transition: opacity 200ms ease, box-shadow 200ms ease;
}
.mv-thumb.current { box-shadow: 0 0 0 2px #5E9BFF; opacity: 1; }
.mv-thumb img, .mv-thumb video { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.mv-thumbplay {
  position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; margin: -13px 0 0 -13px;
  display: grid; place-items: center; border-radius: 13px; background: rgba(0, 0, 0, 0.55); color: #FFFFFF;
}
.mv-thumbplay .icon { width: 13px; height: 13px; }
.mv-thumbicon { position: absolute; inset: 0; display: grid; place-items: center; background: #1D2944; color: #8DB8FF; }
.mv-thumbicon .icon { width: 26px; height: 26px; }
.mv-dur {
  position: absolute; right: 4px; bottom: 4px; height: 16px; padding: 0 5px;
  display: flex; align-items: center; border-radius: 8px;
  background: rgba(0, 0, 0, 0.55); color: #FFFFFF; font-size: 10px; font-weight: 700;
}
.mv-dur[hidden] { display: none; }

.mv-toast {
  position: fixed; left: 50%; bottom: 120px; z-index: 50; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; padding: 12px 18px;
  border-radius: 22px; background: #E3E9F5; color: #1B2335;
  font-size: 14px; font-weight: 600; white-space: nowrap; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.mv-toast.show { animation: mv-toast 300ms ease both; }
.mv-toast[hidden] { display: none; }
.mv-toast .icon { width: 16px; height: 16px; }

/* ---------- Телефон ---------- */

@media (max-width: 899px) {
  .mv {
    display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain;
    padding: env(safe-area-inset-top) 0 calc(24px + env(safe-area-inset-bottom));
  }
  .mv-desk { display: none !important; }
  .mv-phone { display: flex !important; }
  .mv-head { flex: none; height: 56px; padding: 0 12px; }
  .mv-save { padding: 0 12px 0 10px; }
  .mv-save span { display: none; }
  .mv-stage { flex: none; width: 100%; aspect-ratio: 4 / 3; border-radius: 0; order: 1; }
  .mv-controls { order: 2; margin-top: 0; }
  .mv-thumbs { order: 3; flex: none; justify-content: flex-start; padding: 14px 16px 0; }
  .mv-nav { order: 4; }
  .mv-info { order: 5; overflow: visible; padding: 14px 16px 0; gap: 10px; border-radius: 0; background: none; }
  .mv-keys { display: none; }
  .mv-thumb { width: 68px; height: 51px; }

  .mv-vbar2 { flex-direction: column; gap: 6px; padding: 8px 16px 0; }
  .mv-vtime { display: flex; align-items: center; gap: 10px; }
  .mv-vtime .mv-cur { width: 36px; font-size: 12px; }
  .mv-vtime .mv-left { width: 40px; font-size: 12px; }
  .mv-vrow { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
  .mv-vrow .mv-pill { justify-self: start; }
  .mv-vbtns { display: flex; align-items: center; gap: 10px; }
  .mv-vbtns .mv-round { width: 44px; height: 44px; border-radius: 22px; }
  .mv-vbtns .mv-round .icon { width: 22px; height: 22px; }

  .mv-audio { gap: 12px; }
  .mv-atitle { font-size: 22px; line-height: 28px; }
  .mv-asub { font-size: 14px; line-height: 20px; }
  .mv-wave.mv-phone { width: 336px; height: 56px; }
  .mv-abtns { gap: 16px; }
  .mv-audio .mv-play.huge { width: 72px; height: 72px; }

  .mv-nav { justify-content: space-between; align-items: center; padding: 10px 16px 0; }
  .mv-nav > span { font-size: 12px; line-height: 36px; color: #6F7D99; }
  .mv-step {
    height: 36px; padding: 0; border: 0; background: none;
    display: flex; align-items: center; gap: 4px;
    font-size: 14px !important; font-weight: 600; color: #8DB8FF !important;
  }
  .mv-step .icon { width: 14px; height: 14px; }
  .mv-step:disabled { opacity: 0.3; pointer-events: none; }
}

/* Узкий телефон: волна из макета шире экрана. */
@media (max-width: 380px) {
  .mv-wave.mv-phone { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .mv, .mv *, .mv-toast { animation: none !important; transition: none !important; }
}
