.morphoza-view {
  display: flex;
  flex-direction: column;
  gap: clamp(14px, 1.8vh, 24px);
  padding: clamp(16px, 2vh, 28px);
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.08), transparent 36%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0)),
    #050505;
  height: 100%;
  min-height: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: auto;
}

.morphoza-view[hidden],
.morphoza-carousel-view[hidden],
.morphoza-player-view[hidden] {
  display: none !important;
}

.morphoza-header {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: 1rem;
}

.morphoza-title {
  margin: 0;
  text-align: center;
  font-size: clamp(1.45rem, 3vh, 2.6rem);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.morphoza-back {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  padding: 0.85rem 1rem;
  min-height: 48px;
  font: inherit;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.morphoza-back:hover,
.morphoza-back:focus-visible,
.morphoza-nav:hover,
.morphoza-nav:focus-visible {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.38);
  transform: translateY(-1px);
}

.morphoza-carousel-view {
  flex: 0 0 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(32px, 4.2vh, 54px);
  height: auto;
  padding-bottom: clamp(20px, 4vh, 42px);
}

.morphoza-player-view {
  flex: 1 1 auto;
  min-height: 0;
}

.morphoza-rail {
  --rail-order: 1;
  --rail-title-color: #8fc8ff;
  --rail-header-line: linear-gradient(90deg, rgba(143, 200, 255, 0.95), rgba(143, 200, 255, 0.12));
  --rail-header-glow: 0 0 16px rgba(143, 200, 255, 0.24);
  --rail-carousel-border: rgba(143, 200, 255, 0.14);
  --rail-carousel-bg:
    radial-gradient(circle at 24% 18%, rgba(143, 200, 255, 0.16), transparent 34%),
    radial-gradient(circle at 80% 78%, rgba(95, 160, 255, 0.08), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0)),
    #06101a;
  --rail-carousel-before:
    radial-gradient(circle at 28% 24%, rgba(143, 200, 255, 0.12), transparent 40%),
    radial-gradient(circle at 76% 70%, rgba(170, 225, 255, 0.06), transparent 52%),
    radial-gradient(circle at 50% 88%, rgba(120, 170, 255, 0.05), transparent 56%);
  --rail-carousel-inset: inset 0 0 0 1px rgba(143, 200, 255, 0.05);
  --rail-item-bg: linear-gradient(180deg, rgba(143, 200, 255, 0.06), rgba(255, 255, 255, 0.03));
  --rail-item-active-border: rgba(143, 200, 255, 0.38);
  --rail-item-active-glow: 0 0 34px rgba(143, 200, 255, 0.2);
  --rail-nav-border: rgba(143, 200, 255, 0.22);
  --rail-nav-bg: linear-gradient(180deg, rgba(143, 200, 255, 0.08), rgba(8, 18, 32, 0.35));
  --rail-nav-color: #a8d9ff;
  --rail-nav-inset: inset 0 0 0 1px rgba(143, 200, 255, 0.04);
  min-height: 0;
  display: block;
  position: relative;
  isolation: isolate;
  order: var(--rail-order);
}

.morphoza-rail[data-morphoza-rail="justMe"] {
  --rail-order: 2;
}

.morphoza-rail[data-morphoza-rail="cooperation"] {
  --rail-order: 1;
  --rail-title-color: #95f2c7;
  --rail-header-line: linear-gradient(90deg, rgba(149, 242, 199, 0.96), rgba(255, 220, 162, 0.2));
  --rail-header-glow: 0 0 18px rgba(149, 242, 199, 0.22);
  --rail-carousel-border: rgba(149, 242, 199, 0.16);
  --rail-carousel-bg:
    radial-gradient(circle at 18% 18%, rgba(104, 238, 187, 0.16), transparent 34%),
    radial-gradient(circle at 78% 76%, rgba(255, 213, 131, 0.08), transparent 44%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0)),
    #051310;
  --rail-carousel-before:
    radial-gradient(circle at 26% 22%, rgba(122, 255, 210, 0.13), transparent 40%),
    radial-gradient(circle at 76% 74%, rgba(255, 230, 166, 0.06), transparent 52%),
    radial-gradient(circle at 52% 88%, rgba(98, 189, 160, 0.05), transparent 56%);
  --rail-carousel-inset: inset 0 0 0 1px rgba(149, 242, 199, 0.05);
  --rail-item-bg: linear-gradient(180deg, rgba(149, 242, 199, 0.07), rgba(255, 228, 176, 0.03));
  --rail-item-active-border: rgba(149, 242, 199, 0.42);
  --rail-item-active-glow: 0 0 34px rgba(149, 242, 199, 0.18);
  --rail-nav-border: rgba(149, 242, 199, 0.24);
  --rail-nav-bg: linear-gradient(180deg, rgba(149, 242, 199, 0.08), rgba(8, 28, 23, 0.36));
  --rail-nav-color: #d4ffe6;
  --rail-nav-inset: inset 0 0 0 1px rgba(149, 242, 199, 0.04);
}

.morphoza-rail[data-morphoza-rail="mine"] {
  --rail-order: 3;
  --rail-title-color: #f3c2ff;
  --rail-header-line: linear-gradient(90deg, rgba(243, 194, 255, 0.95), rgba(243, 194, 255, 0.12));
  --rail-header-glow: 0 0 16px rgba(243, 194, 255, 0.22);
  --rail-carousel-border: rgba(243, 194, 255, 0.15);
  --rail-carousel-bg:
    radial-gradient(circle at 74% 20%, rgba(243, 194, 255, 0.18), transparent 34%),
    radial-gradient(circle at 18% 82%, rgba(255, 180, 212, 0.08), transparent 44%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0)),
    #170814;
  --rail-carousel-before:
    radial-gradient(circle at 72% 24%, rgba(243, 194, 255, 0.13), transparent 40%),
    radial-gradient(circle at 24% 76%, rgba(255, 205, 228, 0.06), transparent 52%),
    radial-gradient(circle at 52% 88%, rgba(255, 176, 214, 0.05), transparent 56%);
  --rail-carousel-inset: inset 0 0 0 1px rgba(243, 194, 255, 0.05);
  --rail-item-bg: linear-gradient(180deg, rgba(243, 194, 255, 0.06), rgba(255, 255, 255, 0.03));
  --rail-item-active-border: rgba(243, 194, 255, 0.4);
  --rail-item-active-glow: 0 0 34px rgba(243, 194, 255, 0.2);
  --rail-nav-border: rgba(243, 194, 255, 0.22);
  --rail-nav-bg: linear-gradient(180deg, rgba(243, 194, 255, 0.08), rgba(28, 10, 24, 0.36));
  --rail-nav-color: #ffd6ff;
  --rail-nav-inset: inset 0 0 0 1px rgba(243, 194, 255, 0.04);
}

.morphoza-rail[data-morphoza-rail="looooong"] {
  --rail-order: 4;
  --rail-title-color: #ffc86f;
  --rail-header-line: linear-gradient(90deg, rgba(255, 200, 111, 0.95), rgba(255, 130, 92, 0.18));
  --rail-header-glow: 0 0 18px rgba(255, 183, 88, 0.24);
  --rail-carousel-border: rgba(255, 200, 111, 0.16);
  --rail-carousel-bg:
    radial-gradient(circle at 74% 18%, rgba(255, 200, 111, 0.18), transparent 34%),
    radial-gradient(circle at 18% 80%, rgba(255, 130, 92, 0.09), transparent 44%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0)),
    #1a1006;
  --rail-carousel-before:
    radial-gradient(circle at 70% 24%, rgba(255, 213, 138, 0.14), transparent 40%),
    radial-gradient(circle at 24% 76%, rgba(255, 147, 103, 0.06), transparent 52%),
    radial-gradient(circle at 52% 88%, rgba(214, 136, 77, 0.05), transparent 56%);
  --rail-carousel-inset: inset 0 0 0 1px rgba(255, 200, 111, 0.05);
  --rail-item-bg: linear-gradient(180deg, rgba(255, 200, 111, 0.07), rgba(255, 146, 103, 0.03));
  --rail-item-active-border: rgba(255, 200, 111, 0.42);
  --rail-item-active-glow: 0 0 34px rgba(255, 200, 111, 0.18);
  --rail-nav-border: rgba(255, 200, 111, 0.24);
  --rail-nav-bg: linear-gradient(180deg, rgba(255, 200, 111, 0.08), rgba(36, 20, 10, 0.36));
  --rail-nav-color: #ffd9a2;
  --rail-nav-inset: inset 0 0 0 1px rgba(255, 200, 111, 0.04);
}

.morphoza-rail + .morphoza-rail {
  margin-top: clamp(10px, 1.6vh, 20px);
  padding-top: clamp(18px, 2.4vh, 28px);
}

.morphoza-rail + .morphoza-rail::before {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  top: 0;
  height: 1px;
  background:
    linear-gradient(90deg, transparent 0%, rgba(140, 196, 255, 0.12) 14%, rgba(233, 190, 255, 0.55) 50%, rgba(255, 196, 140, 0.12) 86%, transparent 100%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03),
    0 0 18px rgba(220, 180, 255, 0.18);
  pointer-events: none;
}

.morphoza-rail + .morphoza-rail::after {
  content: "";
  position: absolute;
  top: -7px;
  left: 50%;
  width: 120px;
  height: 14px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(255, 233, 190, 0.2) 0%, rgba(255, 233, 190, 0.08) 35%, transparent 72%);
  pointer-events: none;
  filter: blur(1px);
}

.morphoza-rail-header {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: clamp(28px, 3.4vh, 38px);
  padding-inline: clamp(4px, 0.8vw, 10px);
  margin-bottom: clamp(12px, 1.8vh, 18px);
  position: relative;
  z-index: 2;
}

.morphoza-rail-title {
  margin: 0;
  font-size: clamp(0.92rem, 1.3vh, 1.2rem);
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.08);
  color: var(--rail-title-color);
}

.morphoza-rail-header::after {
  content: "";
  display: block;
  width: clamp(72px, 10vw, 120px);
  height: 1px;
  margin-left: 1rem;
  opacity: 0.85;
  background: var(--rail-header-line);
  box-shadow: var(--rail-header-glow);
}

.morphoza-carousel-shell {
  height: auto;
  min-height: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(10px, 1.5vw, 20px);
  position: relative;
  z-index: 1;
}

.morphoza-carousel-shell.is-empty {
  grid-template-columns: minmax(0, 1fr);
}

.morphoza-carousel {
  height: clamp(230px, 31vh, 320px);
  min-height: 0;
  position: relative;
  overflow: hidden;
  perspective: 1200px;
  border: 1px solid var(--rail-carousel-border);
  background: var(--rail-carousel-bg);
  box-shadow: var(--rail-carousel-inset);
}

.morphoza-carousel::before {
  content: "";
  position: absolute;
  inset: -10%;
  background: var(--rail-carousel-before);
  transform: translateX(var(--bg-shift, 0px));
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.morphoza-carousel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse at center,
    rgba(0, 0, 0, 0) 40%,
    rgba(0, 0, 0, 0.35) 100%
  );
}

.morphoza-track {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  transform-style: preserve-3d;
}

.morphoza-item {
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(160px, 14vw, 220px);
  aspect-ratio: 16 / 12;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--rail-item-bg);
  box-shadow: 0 26px 55px rgba(0, 0, 0, 0.28);
  opacity: var(--item-opacity, 0);
  z-index: var(--item-z, 0);
  will-change: transform;
  transform:
    translate(-50%, -50%)
    translateX(var(--item-x, 0px))
    translateY(var(--item-y, 0px))
    rotateY(var(--item-rotate, 0deg))
    scale(var(--item-scale, 1));
  filter:
    brightness(var(--item-brightness, 0.72))
    blur(var(--item-blur, 0px));
  transition:
    transform 0.7s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.5s ease,
    filter 0.45s ease,
    box-shadow 0.45s ease,
    border-color 0.45s ease;
  overflow: hidden;
}

.morphoza-item.is-active {
  border-color: var(--rail-item-active-border);
  filter: brightness(1) blur(0px);
  box-shadow:
    0 45px 110px rgba(0, 0, 0, 0.55),
    var(--rail-item-active-glow);
}

.morphoza-empty-state {
  height: 100%;
  min-height: clamp(180px, 22vh, 220px);
  display: grid;
  place-items: center;
  padding: clamp(18px, 2.4vh, 30px);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012)),
    rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
}

.morphoza-empty-copy {
  margin: 0;
  max-width: 26ch;
  text-align: center;
  font-size: clamp(0.72rem, 0.95vw, 0.92rem);
  line-height: 1.5;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rail-title-color);
  opacity: 0.88;
}

.morphoza-item.is-active::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(
      circle at center,
      rgba(255, 255, 255, 0.12),
      rgba(255, 255, 255, 0.04) 40%,
      transparent 70%
    );
  animation: morphozaGlow 4s ease-in-out infinite;
}

.morphoza-item:hover,
.morphoza-item:focus-visible {
  filter:
    brightness(calc(var(--item-brightness, 0.72) + 0.12))
    blur(var(--item-blur, 0px));
}

.morphoza-carousel.moving .morphoza-item {
  filter:
    blur(0.6px)
    brightness(var(--item-brightness, 0.72));
}

.morphoza-item-button {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  text-align: left;
}

.morphoza-item-figure {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: #111;
  aspect-ratio: 16 / 9;
}

.morphoza-item-figure img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  transform: scale(var(--thumb-scale, 1)) translate(var(--thumb-x, 0px), var(--thumb-y, 0px));
  transition: transform 0.45s ease, filter 0.45s ease;
}

.morphoza-item:hover .morphoza-item-figure img,
.morphoza-item:focus-visible .morphoza-item-figure img {
  transform: scale(var(--thumb-scale, 1.04)) translate(var(--thumb-x, 0px), var(--thumb-y, 0px));
  filter: brightness(1.08);
}

.morphoza-item.is-active .morphoza-item-figure img {
  transform: scale(var(--thumb-scale, 1.03)) translate(var(--thumb-x, 0px), var(--thumb-y, 0px));
}

.morphoza-item-title {
  margin: 0;
  padding: 0.5rem 0.1rem 0;
  flex: 0 0 auto;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: clamp(0.38rem, 0.45vw, 0.48rem);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.3;
  opacity: 0.75;
  transition: font-size 0.35s ease, opacity 0.35s ease;
}

.morphoza-item:not(.is-active) .morphoza-item-title {
  opacity: 0.82;
}

.morphoza-item.is-active .morphoza-item-title {
  font-size: clamp(0.48rem, 0.6vw, 0.6rem);
  opacity: 1;
  padding-top: 8px;
}

.morphoza-nav {
  appearance: none;
  touch-action: manipulation;
  width: clamp(44px, 4vw, 58px);
  height: clamp(82px, 12vh, 128px);
  border: 1px solid var(--rail-nav-border);
  background: var(--rail-nav-bg);
  color: var(--rail-nav-color);
  cursor: pointer;
  font-size: clamp(1.25rem, 2.2vw, 1.8rem);
  display: inline-grid;
  place-items: center;
  box-shadow: var(--rail-nav-inset);
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.morphoza-player-view {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 1rem;
}

.morphoza-player-frame {
  min-height: 0;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #000;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

.morphoza-player-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

@keyframes morphozaGlow {
  0% {
    opacity: 0.7;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.7;
  }
}

@media (max-width: 900px) {
  .morphoza-view {
    height: 100%;
    min-height: 0;
    gap: 12px;
    padding: 68px 10px 14px;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .morphoza-header {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .morphoza-title {
    font-size: clamp(1.05rem, 4vw, 1.4rem);
    text-align: center;
    letter-spacing: 0.09em;
  }

  .morphoza-carousel-view {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: auto;
    gap: 28px;
    padding-bottom: 12px;
  }

  .morphoza-rail {
    display: block;
  }

  .morphoza-rail + .morphoza-rail {
    margin-top: 8px;
    padding-top: 24px;
  }

  .morphoza-rail + .morphoza-rail::before {
    left: 7%;
    right: 7%;
  }

  .morphoza-rail + .morphoza-rail::after {
    width: 88px;
    top: -6px;
  }

  .morphoza-rail-header::after {
    width: 62px;
    margin-left: 0.7rem;
  }

  .morphoza-rail-title {
    font-size: 0.8rem;
    letter-spacing: 0.12em;
  }

  .morphoza-carousel-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
    gap: 0;
  }

  .morphoza-nav {
    display: none;
  }

  .morphoza-carousel {
    height: auto;
    min-height: 0;
    overflow: visible;
    padding: 12px 0 6px;
  }

  .morphoza-track {
    display: flex;
    flex-direction: column;
    gap: 28px;
    height: auto;
    padding: 0 10px 18px;
  }

  .morphoza-item {
    position: relative;
    left: auto;
    top: auto;
    width: 100%;
    aspect-ratio: auto;
    padding: 12px;
    opacity: 1;
    filter: none;
    transform: none;
  }

  .morphoza-item,
  .morphoza-item.is-active,
  .morphoza-item:hover,
  .morphoza-item:focus-visible,
  .morphoza-carousel.moving .morphoza-item {
    filter: none;
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.22);
  }

  .morphoza-item.is-active::after {
    display: none;
  }

  .morphoza-item-button {
    gap: 12px;
  }

  .morphoza-item.is-inline-player {
    padding: 12px;
  }

  .morphoza-item.is-inline-player .morphoza-item-figure {
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
    background: #000;
  }

  .morphoza-item.is-inline-player .morphoza-item-figure iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
  }

  .morphoza-item-title,
  .morphoza-item.is-active .morphoza-item-title {
    display: block;
    order: -1;
    margin: 0 0 4px;
    font-size: 0.72rem;
    padding: 0;
    line-height: 1.35;
    opacity: 1;
    -webkit-line-clamp: unset;
    -webkit-box-orient: initial;
    overflow: visible;
    white-space: normal;
    word-break: break-word;
  }

  .morphoza-item-figure {
    aspect-ratio: 16 / 9;
  }

  .morphoza-item-figure img,
  .morphoza-item:hover .morphoza-item-figure img,
  .morphoza-item:focus-visible .morphoza-item-figure img,
  .morphoza-item.is-active .morphoza-item-figure img {
    transform: none;
  }

  .morphoza-player-view {
    min-height: 0;
  }
}
