/* ============================================================
   1. КАСТОМНЫЕ КОНТРОЛЫ ВИДЕО (.custom-video)
   ============================================================ */
.custom-video-wrap{position:relative;width:100%}
.custom-video{position:relative;width:100%;aspect-ratio:16/9;background:#050811;border-radius:16px;overflow:hidden;user-select:none;-webkit-user-select:none;-webkit-tap-highlight-color:transparent}
.custom-video *{user-select:none;-webkit-user-select:none}
.custom-video video{display:block;width:100%;height:100%;object-fit:cover;background:#050811;border-radius:16px;cursor:pointer}
.custom-video.is-hidden{cursor:none}
.custom-video.is-hidden video{cursor:none}
.custom-video.is-playing .custom-video__big-play,
.custom-video-wrap.is-playing .custom-video__big-play,
.custom-video.is-hidden .custom-video__big-play,
.custom-video-wrap.is-hidden .custom-video__big-play{opacity:0;pointer-events:none}
.custom-video__big-play{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:72px;height:72px;min-width:72px;border-radius:50%;border:2px solid rgba(0,220,230,.7);background:radial-gradient(circle at 35% 30%,rgba(0,220,230,.55),rgba(8,12,22,.88));color:#fff;cursor:pointer;display:grid;place-items:center;z-index:3;box-shadow:0 0 30px rgba(0,197,207,.35),inset 0 1px 0 rgba(255,255,255,.18);transition:transform .22s ease,box-shadow .22s ease,opacity .25s ease}
.custom-video__big-play svg{width:32px;height:32px;fill:#fff;display:block;margin-left:3px}
.custom-video__big-play:hover{transform:translate(-50%,-50%) scale(1.06);box-shadow:0 0 40px rgba(0,197,207,.55),inset 0 1px 0 rgba(255,255,255,.22)}
.custom-video__controls{position:absolute;inset:0;z-index:4;pointer-events:none;opacity:1;transition:opacity .3s ease}
.custom-video.is-hidden .custom-video__controls,
.custom-video-wrap.is-hidden .custom-video__controls{opacity:0;pointer-events:none}
.custom-video__bottom{position:absolute;left:0;right:0;bottom:0;display:flex;align-items:center;gap:.6rem;padding:.65rem .75rem .55rem;background:linear-gradient(to top,rgba(0,0,0,.72),rgba(0,0,0,.35) 60%,transparent);pointer-events:auto}
.custom-video__toggle{flex-shrink:0;width:34px;height:34px;min-width:34px;display:grid;place-items:center;border-radius:50%;border:none;background:transparent;color:#fff;cursor:pointer;transition:all .2s ease}
.custom-video__toggle:hover{background:rgba(255,255,255,.12);transform:scale(1.08)}
.custom-video__toggle svg{width:20px;height:20px;fill:#fff;display:block}
.custom-video__bar{flex:1;min-width:0;position:relative;height:20px;display:flex;align-items:center;cursor:pointer;touch-action:none}
.custom-video__track{position:absolute;left:0;right:0;top:50%;transform:translateY(-50%);height:4px;border-radius:99px;background:rgba(255,255,255,.26);overflow:hidden;transition:height .15s ease}
.custom-video__bar:hover .custom-video__track{height:6px}
.custom-video__fill{position:absolute;left:0;top:0;bottom:0;width:0;border-radius:99px;background:linear-gradient(90deg,#00dce6,#63edf1);box-shadow:0 0 10px rgba(0,220,230,.5);transition:width .1s linear}
.custom-video__time{flex-shrink:0;font:700 .72rem/1 var(--rmz-font-mono, 'Courier New', monospace);color:rgba(255,255,255,.88);letter-spacing:.03em;white-space:nowrap;text-shadow:0 1px 2px rgba(0,0,0,.5)}
.custom-video__fullscreen{flex-shrink:0;width:34px;height:34px;min-width:34px;display:grid;place-items:center;border-radius:50%;border:none;background:transparent;color:#fff;cursor:pointer;transition:all .2s ease}
.custom-video__fullscreen:hover{background:rgba(255,255,255,.12);transform:scale(1.08)}
.custom-video__fullscreen svg{width:18px;height:18px;fill:#fff;display:block}
.video-loader{position:absolute;inset:0;display:none;align-items:center;justify-content:center;background:rgba(5,8,17,.55);z-index:5;pointer-events:none;border-radius:inherit}
.video-loader.is-active{display:flex}
.video-loader__disc{width:56px;height:56px;border-radius:50%;border:3px solid rgba(255,255,255,.12);border-top-color:#00dce6;border-right-color:#00dce6;animation:rmzDiscSpin .8s linear infinite;box-shadow:0 0 18px rgba(0,220,230,.35)}
@keyframes rmzDiscSpin{from{transform:rotate(0)}to{transform:rotate(360deg)}}
.custom-video video:not([data-rmz-loaded="1"]){background-color:#0a0f1a;background-image:linear-gradient(135deg,rgba(0,183,194,.08),rgba(212,175,55,.06));background-size:cover;background-position:center}
@media(max-width:700px){
  .custom-video__big-play{width:60px;height:60px;min-width:60px}
  .custom-video__big-play svg{width:26px;height:26px}
  .custom-video__bottom{padding:.5rem .55rem .4rem;gap:.4rem}
  .custom-video__toggle{width:30px;height:30px;min-width:30px}
  .custom-video__toggle svg{width:18px;height:18px}
  .custom-video__fullscreen{width:30px;height:30px;min-width:30px}
  .custom-video__fullscreen svg{width:16px;height:16px}
  .custom-video__time{font-size:.62rem}
  .custom-video__track{height:3px}
  .custom-video__bar:hover .custom-video__track{height:5px}
  .video-loader__disc{width:44px;height:44px;border-width:2.5px}
}
@media(prefers-reduced-motion:reduce){
  .video-loader__disc{animation:none!important}
}

/* ============================================================
   2. ОБЁРТКИ ВИДЕО
   ============================================================ */

.video-wrapper-vertical {
    max-width: 45%;
    margin: 0.8rem 1.5rem 0.8rem 0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    background: #000;
    float: left;
    clear: none;
    position: relative;
}
.video-wrapper-vertical.float-right {
    float: right;
    margin: 0.8rem 0 0.8rem 1.5rem;
}
.video-wrapper-vertical > .custom-video-wrap,
.video-wrapper-horizontal > .custom-video-wrap {
    width: 100%;
    max-width: 100%;
    margin: 0;
    float: none;
    position: relative;
}
.video-wrapper-vertical > .custom-video-wrap > .custom-video {
    aspect-ratio: 9 / 16;
    border-radius: 0;
    width: 100%;
}
.video-wrapper-horizontal > .custom-video-wrap > .custom-video {
    aspect-ratio: 16 / 9;
    border-radius: 0;
    width: 100%;
}
.video-wrapper-vertical .video-caption,
.video-wrapper-horizontal .video-caption {
    font-family: 'Arial', sans-serif;
    font-size: 0.8rem;
    color: #555;
    padding: 6px 10px;
    text-align: center;
    background: #f8f6f0;
    font-style: italic;
    border-top: 1px solid rgba(0, 0, 0, 0.04);
}
.video-wrapper-horizontal {
    max-width: 500px;
    margin: 1.5rem auto;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    background: #000;
    clear: both;
    position: relative;
}
.video-wrapper-horizontal .video-caption {
    font-size: 0.85rem;
    padding: 8px 12px;
}
.video-wrapper-vertical .play-overlay,
.video-wrapper-horizontal .play-overlay { display: none !important; }

/* ============================================================
   Видео-пара (глава 12) — всегда в один ряд, как в главе 5
   ============================================================ */
.video-pair {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1.2rem !important;
    margin: 2rem auto !important;
    max-width: 700px !important;
    clear: both !important;
    align-items: start !important;
}

.video-pair .video-wrapper-vertical {
    float: none !important;
    margin: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
}

/* Внутри каждого видео-враппера — сохраняем вертикальный формат 9:16 */
.video-pair .video-wrapper-vertical > .custom-video-wrap,
.video-pair .video-wrapper-vertical > .custom-video-wrap > .custom-video {
    width: 100% !important;
}

.video-pair .video-wrapper-vertical .custom-video {
    aspect-ratio: 9 / 16 !important;
    border-radius: 12px !important;
}

/* Подпись под видео — компактная */
.video-pair .video-wrapper-vertical .video-caption {
    font-size: 0.78rem !important;
    line-height: 1.4 !important;
    padding: 8px 10px !important;
    text-align: center !important;
}

/* Мобильный — тоже два столбца, но с меньшими отступами */
@media (max-width: 700px) {
    .video-pair {
        gap: 0.6rem !important;
        max-width: 100% !important;
        margin: 1.2rem auto !important;
    }
    .video-pair .video-wrapper-vertical .video-caption {
        font-size: 0.7rem !important;
        padding: 6px 8px !important;
    }
}

@media (max-width: 380px) {
    .video-pair {
        gap: 0.4rem !important;
    }
    .video-pair .video-wrapper-vertical .video-caption {
        font-size: 0.65rem !important;
        padding: 5px 6px !important;
    }
}

/* ============================================================
   3. ЭКСПЕРИМЕНТ-СЕТКА
   ============================================================ */

.experiment-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 1.2rem !important;
    max-width: 800px !important;
    margin: 2rem auto !important;
    clear: both !important;
}
.experiment-card {
    background: #fff !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05) !important;
    padding: 0 !important;
    border: 1px solid rgba(0, 0, 0, 0.04) !important;
}
.experiment-card .custom-video-wrap {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    float: none !important;
    box-shadow: none !important;
}
.experiment-card .custom-video {
    aspect-ratio: 9 / 16 !important;
}
/* Скрываем дубликат заголовка под видео (оставляем только текст под карточкой) */
.experiment-card .video-caption {
    display: none !important;
}
.experiment-card .experiment-title {
    display: block !important;
    padding: 8px 10px 4px !important;
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    text-align: center !important;
    color: #1a1a1a !important;
    font-family: 'Playfair Display', Georgia, serif !important;
}
.experiment-card .experiment-description {
    display: block !important;
    padding: 0 10px 10px !important;
    font-size: 0.78rem !important;
    text-align: center !important;
    color: #555 !important;
    line-height: 1.4 !important;
}

/* ============================================================
   4. АУДИО-ПЛЕЕР (.remiz-player) — единственный источник стилей
   Тёмная тема, совместима с main.css / idea-recorder.css
   ============================================================ */
.remiz-player {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  position: relative;
  padding: 10px 14px 12px;
  border: 1px solid rgba(0, 220, 230, 0.22);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(0, 197, 207, 0.06), rgba(10, 15, 25, 0.55));
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.remiz-player:hover {
  border-color: rgba(0, 220, 230, 0.42);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Шапка: title + artist + hint */
.remiz-player__head {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding-bottom: 0.35rem;
  margin-bottom: 0.45rem;
  border-bottom: 1px solid rgba(127, 246, 247, 0.2);
  min-width: 0;
  position: relative;
}
.remiz-player__title {
  font: 700 0.92rem/1.2 Georgia, 'Times New Roman', serif;
  color: #ffffff;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 1 auto;
  padding: 0;
  border-bottom: 0;
}
.remiz-player__artist {
  font: 400 0.7rem/1.3 system-ui, -apple-system, sans-serif;
  color: rgba(180, 196, 208, 0.78);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 1 auto;
  min-width: 0;
}
.remiz-player__artist::before {
  content: '·';
  margin-right: 0.35rem;
  color: rgba(180, 196, 208, 0.42);
  font-weight: 700;
}
.remiz-player__hint {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  min-width: 20px;
  border-radius: 50%;
  border: 1px solid rgba(116, 238, 244, 0.5);
  background: rgba(0, 197, 207, 0.1);
  color: rgba(180, 250, 255, 0.95);
  font: 800 0.68rem/1 system-ui, -apple-system, sans-serif;
  cursor: pointer;
  padding: 0;
  transition: all 0.22s ease;
  margin-left: auto;
}
.remiz-player__hint:hover,
.remiz-player__hint:focus-visible {
  border-color: rgba(116, 238, 244, 1);
  background: rgba(0, 197, 207, 0.28);
  color: #fff;
  box-shadow: 0 0 10px rgba(0, 197, 207, 0.5);
  transform: scale(1.08);
  outline: none;
}

/* Ряд: кнопка + прогресс + таймаут */
.remiz-player__row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
}
.remiz-player__btn {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid rgba(0, 220, 230, 0.55);
  background: radial-gradient(circle at 35% 30%, rgba(0, 220, 230, 0.32), rgba(0, 0, 0, 0.4));
  color: #eaffff;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(0, 197, 207, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition: all 0.2s ease;
  padding: 0;
  flex-shrink: 0;
}
.remiz-player__btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 24px rgba(0, 197, 207, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.remiz-player__btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}
.remiz-player__btn svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
  color: currentColor;
  display: block;
  flex-shrink: 0;
}
.remiz-player__btn .rmz-play-icon,
.remiz-player__btn .rmz-pause-icon {
  width: 15px;
  height: 15px;
  min-width: 15px;
  display: block;
  flex-shrink: 0;
  fill: currentColor;
}

/* Прогресс */
.remiz-player__bar {
  flex: 1 1 auto;
  min-width: 0;
  position: relative;
  height: 20px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
}
.remiz-player__track {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
  pointer-events: none;
}
.remiz-player__fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, #00dce6, #63edf1);
  box-shadow: 0 0 10px rgba(0, 220, 230, 0.5);
  transition: width 0.1s linear;
}

/* Время */
.remiz-player__time {
  font: 700 0.68rem/1 'Courier New', monospace;
  color: rgba(224, 236, 240, 0.82);
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 72px;
  text-align: right;
}

/* Состояние воспроизведения */
.remiz-player.is-playing .remiz-player__btn {
  animation: playerPulse 1.2s ease-in-out infinite;
}
@keyframes playerPulse {
  50% {
    box-shadow: 0 0 22px rgba(0, 220, 230, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  }
}

/* Мобильный */
@media (max-width: 480px) {
  .remiz-player { padding: 8px 10px 10px; }
  .remiz-player__btn { width: 30px; height: 30px; min-width: 30px; }
  .remiz-player__btn svg,
  .remiz-player__btn .rmz-play-icon,
  .remiz-player__btn .rmz-pause-icon { width: 13px; height: 13px; min-width: 13px; }
  .remiz-player__time { font-size: 0.62rem; min-width: 64px; }
  .remiz-player__title { font-size: 0.82rem; }
  .remiz-player__artist { font-size: 0.6rem; }
  .remiz-player__hint { width: 18px; height: 18px; min-width: 18px; font-size: 0.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  .remiz-player.is-playing .remiz-player__btn { animation: none !important; }
}

/* ============================================================
   5. АДАПТИВ
   ============================================================ */

@media (max-width: 1024px) {
    .video-wrapper-vertical {
        max-width: 45%;
        float: left;
        margin: 0.5rem 1rem 0.5rem 0;
    }
    .video-wrapper-vertical.float-right {
        float: right;
        margin: 0.5rem 0 0.5rem 1rem;
    }
    .video-pair {
        gap: 1rem;
        justify-content: space-between;
    }
    .video-pair .video-wrapper-vertical {
        max-width: 45%;
        margin: 0;
        float: none;
    }
}

@media (max-width: 768px) {
    body { overflow-x: clip; }
    html { overflow-x: clip; }

    .video-wrapper-vertical,
    .video-wrapper-vertical.float-right {
        max-width: 45% !important;
        float: left !important;
        margin: 0.5rem 1rem 0.5rem 0 !important;
    }
    .video-wrapper-vertical.float-right {
        float: right !important;
        margin: 0.5rem 0 0.5rem 1rem !important;
    }
    .video-wrapper-horizontal {
        width: 100% !important;
        max-width: 100% !important;
        float: none !important;
        margin: 1rem auto !important;
    }
    .experiment-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 0.8rem !important;
    }
    .experiment-card .video-caption { font-size: 0.7rem !important; padding: 6px 6px !important; }
    .experiment-card .experiment-title { font-size: 0.8rem !important; padding: 6px 6px 2px !important; }
    .experiment-card .experiment-description { font-size: 0.68rem !important; padding: 0 6px 6px !important; }
}

@media (max-width: 600px) {
    .video-wrapper-horizontal { max-width: 100%; }
}

