:root {
  --x-gap: 1rem;
  --x-radius: 2px;
  --x-size-sm: 0.75rem;
  --x-size-md: 0.875rem;
  --x-trans: all 0.3s cubic-bezier(0, 0, 0.5, 1);
  --x-shadow: 2px 4px 12px #00000014;
  --x-success: rgb(25 135 84);
  --x-info: rgb(13 110 253);
  --x-warning: rgb(255 193 7);
  --x-danger: rgb(220 53 69);
  --x-success-bd: rgb(163 207 187);
  --x-info-bd: rgb(158 197 254);
  --x-warning-bd: rgb(255 230 156);
  --x-danger-bd: rgb(241 174 181);

  color-scheme: light;

  &[data-theme="dark"] {
    --x-success-bd: rgb(15 81 50);
    --x-info-bd: rgb(8 66 152);
    --x-warning-bd: rgb(153 116 4);
    --x-danger-bd: rgb(132 32 41);

    background-color: transparent;
    color-scheme: dark;

    .navbar {
      --x-rgb: 181 181 181;
      --x-bg-rgb: 10 10 10;
    }

    .navbar-dropdown:hover {
      background-color: #0a0a0a !important;
    }

    #tags dt:last-child {
      border-bottom: none !important;
    }

    .box:is(:focus, :hover, :active) {
      box-shadow: none !important;
    }

    nav.pagination {
      border-top: none !important;
    }

    .preview-images a,
    .column-video-cover a,
    .tile-small .tile-item img {
      background-color: #444;
    }
  }
}

html {
  overflow-y: overlay;
  scroll-behavior: smooth;

  &.has-navbar-fixed-bottom {
    padding-bottom: 0;
  }
}

body {
  min-height: 100%;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif,
    "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
}

.compensate-for-scrollbar {
  margin-right: 0 !important;
}

video:focus {
  outline: none;
}

.actors + br,
nav.sub-header,
.actor-filter hr,
#magnets .top-meta,
.app-desktop-banner,
.x-load + nav.pagination,
body:has(.x-load) #footer,
#magnets-content .magnet-name br,
#navbar-menu-hero .navbar-start > a.navbar-item,
.section:has(.video-detail) #search-bar-container,
.movie-panel-info .review-buttons .panel-block:nth-child(2) {
  display: none !important;
}

.navbar {
  --x-rgb: 74 74 74;
  --x-bg-rgb: 238 238 235;

  padding: 0 max(calc((100% - 1344px) / 2), 1rem);

  --x-cl: rgb(var(--x-rgb));
  --x-bd: rgb(var(--x-rgb) / 5%);
  --x-bg: rgb(var(--x-bg-rgb) / 80%);
  --x-hv: rgb(var(--x-bg-rgb) / 50%);

  &.is-black {
    background-color: var(--x-bg) !important;
    backdrop-filter: saturate(1.8) blur(20px);
    border-bottom: 1px solid var(--x-bd);

    .navbar-brand > a.navbar-item:is(:focus, :hover, :focus-within) {
      background-color: var(--x-hv) !important;
    }
  }

  .navbar-brand > .navbar-item svg {
    width: auto;
    height: 2rem;

    path {
      fill: rgb(var(--x-bg-rgb));

      &:last-child {
        fill: #2f80ed;
      }
    }
  }

  .navbar-link {
    font-size: var(--x-size-md);

    &:not(.is-arrowless)::after {
      margin-top: -0.42em;
    }
  }
}

@media screen and (width >= 1024px) {
  .navbar.is-black :is(.navbar-start, .navbar-end) :is(> .navbar-item, .navbar-link) {
    color: var(--x-cl) !important;
  }

  .navbar.is-black :is(.navbar-start, .navbar-end) .navbar-link::after {
    border-color: var(--x-cl) !important;
  }

  .navbar.is-black .navbar-item.has-dropdown:is(:focus, :hover, :focus-within) .navbar-link {
    background-color: var(--x-hv) !important;
  }

  .navbar-dropdown:is(.is-boxed, .is-right) {
    top: 100%;
    border-radius: var(--x-radius);
  }

  .navbar-dropdown.is-right {
    display: block;
    pointer-events: none;
    border-top: none;
    box-shadow:
      0 8px 8px rgb(10 10 10 / 10%),
      0 0 0 1px rgb(10 10 10 / 10%);
    opacity: 0;
    transition-duration: 86ms;
    transition-property: opacity, transform;
    transform: translateY(-5px);
  }

  .navbar-item.is-hoverable:is(:focus, :hover, :focus-within) .navbar-dropdown.is-right {
    pointer-events: auto;
    opacity: 1;
    transform: translateY(0);
  }
}

.search-bar-container {
  margin-bottom: 0.25rem !important;
}

.columns:not(:last-child) {
  margin-bottom: 0.25rem;
}

.search-bar-wrap {
  padding: 0.75rem;
  border-radius: 1px;

  .search-panel .control:first-child {
    overflow: hidden;
    border-top-left-radius: 1px;
    border-bottom-left-radius: 1px;
  }

  .search-panel .control:last-child {
    overflow: hidden;
    border-top-right-radius: 1px;
    border-bottom-right-radius: 1px;
  }

  .search-recent-keywords {
    margin: 0 -0.375rem;
    font-size: var(--x-size-sm);

    li {
      padding: 0 0.375rem;
    }
  }
}

#search-type,
#video-search,
#search-submit,
#button-search-image,
#button-advanced-search {
  border: none;

  &:is(:focus, :hover, :active) {
    z-index: auto !important;
  }
}

.notification:not(:last-child) {
  margin-bottom: 1rem;
}

.site-announce {
  font-size: var(--x-size-sm);
}

.main-tabs {
  margin-bottom: 1rem !important;
}

.tabs {
  &:not(:last-child) {
    margin-bottom: 1rem;
  }

  ul {
    border-bottom: none;
  }

  &.is-boxed a {
    border: none;
  }
}

.toolbar {
  padding: 0 0 0.5rem;
  font-size: 0;

  .button-group {
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
    vertical-align: middle;
  }
}

.movie-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--x-gap);
  align-items: start;
  padding-bottom: 0;

  &.v {
    grid-template-columns: repeat(6, minmax(0, 1fr));

    .item .cover {
      aspect-ratio: 147 / 200;
      padding-top: 0;
    }
  }

  .box {
    padding: 0 0 0.5rem;
    overflow: hidden;
    border-radius: var(--x-radius);
    transition: var(--x-trans);

    &:is(:focus, :hover, :active) {
      box-shadow: var(--x-shadow);
    }

    .video-title,
    .score,
    .meta,
    .tags {
      padding-left: 0.5rem;
    }

    .meta-buttons {
      padding: calc(0.5rem - 5px) 0.5rem 0;

      .button {
        border-radius: 1px;
      }
    }
  }

  .item {
    position: relative;
    transition: border 0.2s;

    &:has(.x-match:not(.is-normal)) {
      border-style: solid;
      border-width: 0.375rem;
      border-radius: calc(0.375rem - 1px);
    }

    &:has(.x-match.is-success) {
      background-color: var(--x-success-bd);
      border-color: var(--x-success-bd);
    }

    &:has(.x-match.is-info) {
      background-color: var(--x-info-bd);
      border-color: var(--x-info-bd);
    }

    &:has(.x-match.is-warning) {
      background-color: var(--x-warning-bd);
      border-color: var(--x-warning-bd);
    }

    &:has(.x-match.is-danger) {
      background-color: var(--x-danger-bd);
      border-color: var(--x-danger-bd);
    }

    .cover {
      padding-top: 67.25%;
      overflow: hidden;

      img {
        width: 100%;
        object-fit: contain;
        transition: var(--x-trans);
      }

      video {
        position: absolute;
        inset: 0;
        z-index: 1;
        width: 100%;
        height: 100%;
        background-color: #000;
        object-fit: contain;
        opacity: 0;
        transition: var(--x-trans);

        &.x-show {
          opacity: 1;
        }

        &::-webkit-media-controls-play-button,
        &::-webkit-media-controls-fullscreen-button,
        &::-webkit-media-controls-timeline {
          display: none;
        }
      }

      .buttons:has(.x-offline) {
        position: absolute;
        top: 0;
        z-index: 2;
      }

      .x-offline {
        min-width: 54px;
        height: 2em;
        padding: 0 0.75em;
        border: none;
      }

      &:hover img {
        z-index: 0;
        transform: none;
      }

      &.x-hovered:not(:has(video)):hover {
        cursor: progress;
      }

      &.x-hovered:hover img {
        filter: blur(2px);
      }
    }

    .video-title {
      display: -webkit-box;
      height: calc(2em * 1.5 + 0.5rem);
      padding-top: 0.5rem;
      padding-right: 0.5rem;
      padding-bottom: 0;
      font-size: var(--x-size-md);
      white-space: normal;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;

      .x-match {
        margin-right: calc(0.375rem - 1px);
        border-radius: 99px;
        transform: translate(-1px, -1px);

        &.is-success {
          background-color: var(--x-success);
        }

        &.is-info {
          background-color: var(--x-info);
        }

        &.is-warning {
          background-color: var(--x-warning);
        }

        &.is-danger {
          background-color: var(--x-danger);
        }
      }
    }

    .score {
      padding-top: 0.75rem;
      padding-bottom: 0;
      font-size: var(--x-size-sm);
    }

    .meta {
      padding-bottom: 0.5rem;
      font-size: var(--x-size-sm);
    }

    .tags.has-addons {
      min-height: 2em;

      .tag:first-child {
        border-top-left-radius: 1px;
        border-bottom-left-radius: 1px;
      }

      .tag:last-child {
        border-top-right-radius: 1px;
        border-bottom-right-radius: 1px;
      }
    }

    &:has(.x-match, .x-offline) .tags.has-addons .tag {
      opacity: 0.75;
    }
  }

  .column:only-child {
    padding: 0;
  }
}

.x-offline {
  min-width: 62px;
  border-radius: 1px !important;
}

.x-load {
  font-size: var(--x-size-md);
  border-radius: 99px !important;

  &[disabled] {
    background-color: transparent !important;
    border-color: transparent !important;
  }

  &.is-loading::after {
    border-color: transparent transparent #7a7a7a #7a7a7a;
  }
}

nav.pagination {
  padding-top: 1rem;
  margin: 0 -0.25rem !important;
  border-top: none;

  .pagination-previous,
  .pagination-next,
  .pagination-link {
    border-radius: var(--x-radius);
  }
}

#footer {
  background-color: transparent;
  border-top: 1px solid var(--x-bd);

  .navbar-item {
    font-size: var(--x-size-md);
    color: var(--x-cl) !important;
  }
}

.title {
  font-size: 1.5rem;

  &:not(:last-child) {
    margin-bottom: 1rem;
  }
}

.main-title {
  padding-top: 0;
  font-size: 1.5rem;
}

#tags {
  margin-top: -0.5rem;
  margin-bottom: 0.5rem;

  dt {
    --x-height: 40px;

    display: flex;
    gap: 0.5rem;
    align-items: baseline;
    justify-content: start;
    padding: 0.5rem 0 0;
    line-height: normal;

    &.collapse {
      display: flex;
      height: calc(var(--x-height) + 1px);

      &:last-child {
        height: var(--x-height);
      }
    }

    &:last-child {
      border-bottom: none;
    }

    a.tag-expand {
      order: 3;
      float: none;
      margin-top: 0;
      transform: translateY(-1px);
    }

    strong {
      margin-right: -0.5rem;
      font-size: var(--x-size-md);
    }

    .tag_labels {
      display: flex;
      flex: 1;
      flex-wrap: wrap;
      gap: 0.5rem;
      align-items: start;
      justify-content: start;
      padding-bottom: 0.5rem;
    }
  }
}

.actors {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--x-gap);
  align-items: start;

  .box {
    margin-bottom: 0;
    overflow: hidden;
    font-size: var(--x-size-md);
    border-radius: var(--x-radius);
    transition: var(--x-trans);

    &:is(:focus, :hover, :active) {
      box-shadow: var(--x-shadow);
    }

    .button {
      margin-top: 0 !important;
      border-radius: 1px;
    }
  }
}

.actor-box a {
  figure {
    aspect-ratio: 1;
    overflow: hidden;

    span.info {
      height: auto;
      padding: 0.25rem;
      font-size: var(--x-size-sm);
    }
  }

  strong {
    padding: 0.75rem;
    line-height: normal;

    &:nth-child(3) {
      padding-top: 0;
    }
  }
}

.section:has(> .awards) {
  padding: 0;

  .divider-title {
    padding-bottom: 0;
    border-bottom: none;
  }

  .awards {
    &:last-child {
      padding-bottom: 0;
    }

    .mb-6 {
      margin-bottom: 0 !important;
    }
  }
}

br + .title {
  margin-top: 1rem;
}

.actor-filter-toolbar {
  padding-bottom: 1rem;
}

.actor-filter {
  padding: 1rem;

  &:not(:last-child) {
    margin-bottom: 1rem;
  }
}

.filter-slider .slider-title {
  font-size: 1rem;
}

.actor-filter-actions {
  font-size: 0;

  a.button {
    margin-right: 0.75rem;
  }
}

.section-container {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--x-gap);
  align-items: start;

  .box {
    padding: 1rem;
    overflow: hidden;
    font-size: var(--x-size-md);
    border-radius: var(--x-radius);
    transition: var(--x-trans);

    &:is(:focus, :hover, :active) {
      box-shadow: var(--x-shadow);
    }

    span {
      font-size: var(--x-size-sm);
    }

    .button {
      border-radius: 1px;
    }
  }

  a {
    display: flex;
    gap: 0.75rem;
    align-items: baseline;

    strong {
      flex: 1;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
  }

  .column:only-child {
    padding: 0;
  }
}

.section-columns {
  padding-top: 0;
}

.actor-tags {
  padding-bottom: 0;
  border-bottom: none;

  .content {
    font-size: 0;

    &:not(.collapse) {
      margin-bottom: -0.5rem;
    }
  }
}

.user-container {
  margin: -1.75rem !important;
}

#user-menu .menu-label {
  padding-inline: 0.75rem;
}

.message-container,
.message:not(:last-child) {
  margin-bottom: 1rem;
}

.message-header,
.message-body {
  padding: 0.75rem;
}

.common-list {
  margin-top: -1rem;

  .list-item {
    margin: 0;
    font-size: 1rem;

    .column {
      padding-inline: 0;
    }

    .meta {
      font-size: var(--x-size-md);
    }
  }

  .field.has-addons {
    align-items: center;
    justify-content: end;
    height: 100%;
  }
}

.box:has(> form) {
  padding: 1rem;
  margin-bottom: 1rem !important;
}

.section:has(.video-detail) {
  padding-bottom: 0;
}

.video-meta-panel {
  padding: 0.75rem;
  margin-bottom: 1rem;
}

.column-video-cover {
  a {
    position: relative;
    display: block;
    aspect-ratio: 400 / 269;
    background-color: #aa9084;

    & > :is(img, video) {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      object-fit: contain;
      max-height: none;
    }

    video {
      background-color: #000;
    }
  }

  .cover-container {
    &::after {
      height: 100%;
    }

    .play-button {
      font-size: 1.5rem;
    }
  }
}

.movie-panel-info {
  font-size: var(--x-size-md);

  div.panel-block {
    align-items: normal;
    padding: 0.5rem 0;

    .copy-to-clipboard {
      width: 1.25rem;
      height: 1.25rem;
      padding: 0;
    }

    .x-match {
      display: -webkit-box;
      overflow: hidden;
      text-overflow: ellipsis;
      word-break: break-all;
      white-space: unset;
      -webkit-line-clamp: 1;
      -webkit-box-orient: vertical;
    }
  }

  & > div.panel-block:first-child {
    padding-top: 0;
  }

  & > div.panel-block:last-child {
    padding-bottom: 0;
    border-bottom: none !important;
  }

  .review-buttons .button {
    border-radius: 1px !important;
  }
}

.fancybox-slide {
  overflow-y: overlay;
  overscroll-behavior: contain;
}

.video-panel {
  .tile-images {
    gap: 0.75rem;
    font-size: 0;

    .tile-item :is(.video-number, .video-title) {
      font-size: var(--x-size-md);
    }
  }

  .magnet-links {
    counter-reset: magnet-counter;

    .item {
      align-items: center;
      margin: 0;

      .magnet-name {
        width: auto;
        font-size: var(--x-size-md);

        a {
          display: flex;
          gap: 0.5rem;
          align-items: center;
        }

        .name {
          display: -webkit-box;
          flex: 1;
          overflow: hidden;
          text-overflow: ellipsis;
          word-break: break-all;
          -webkit-line-clamp: 1;
          -webkit-box-orient: vertical;

          &::before {
            font-weight: normal;
            content: counter(magnet-counter, decimal-leading-zero) ". ";
            counter-increment: magnet-counter;
          }
        }

        .meta {
          flex-shrink: 0;
          width: 150px;
          font-size: var(--x-size-md);
        }

        .tags {
          flex-shrink: 0;
          width: 150px;
          padding-top: 0;
        }
      }

      .date {
        flex-shrink: 0;
        order: 2;
        width: 160px;
        font-size: var(--x-size-md);
        text-align: left;
      }

      .buttons {
        order: 3;
        margin-bottom: 0;
        font-size: 0;

        .button {
          margin-bottom: 0;
          border-radius: 1px;
        }

        &:has(.x-offline) a.button {
          display: none;
        }
      }
    }
  }
}

.preview-images a {
  aspect-ratio: 4 / 3;
  background-color: #aa9084;

  img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
  }
}

.preview-video-container::after {
  height: 100%;
}

#tabs-container {
  margin-top: -1rem;
}

#magnets .message {
  margin-bottom: 0;
}

.tags:has(.x-magnet) {
  .tag {
    background-color: transparent;
  }

  & + #magnets-content {
    max-height: calc(54px * 9);
    overflow-y: overlay;
  }
}

.review-items .review-item {
  padding: 0.75rem 0;

  &:first-child {
    padding-top: 0;
  }

  &:last-child {
    padding-bottom: 0;
  }

  .review-title {
    font-size: var(--x-size-md);

    & > div:first-child {
      margin-left: 0;
    }
  }
}

.plain-grid-list {
  gap: 0.75rem;
  align-items: start;

  a.box {
    display: flex;
    gap: 0.75rem;
    align-items: baseline;
    padding: 1rem;
    margin-bottom: 0;
    overflow: hidden;
    font-size: var(--x-size-md);
    border-radius: var(--x-radius);
    transition: var(--x-trans);

    &:is(:focus, :hover, :active) {
      box-shadow: var(--x-shadow);
    }

    strong {
      flex: 1;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    span {
      font-size: var(--x-size-sm);
    }
  }
}

.tile-small .tile-item {
  display: flex;
  flex-direction: column;

  img {
    flex: 1;
    width: 100%;
    margin-bottom: 0.375rem;
    background-color: #aa9084;
    object-fit: contain;
  }
}
