@charset "utf-8";

:root {
  --color-tier0: #ccc;
  --color-tier1: hsl(0 70% 70%);
  --color-tier2: hsl(30 70% 70%);
  --color-tier3: hsl(60 70% 70%);
  --color-tier4: hsl(90 70% 70%);
  --color-tier5: hsl(120 70% 70%);
  --color-tier6: hsl(150 70% 70%);
  --color-tier7: hsl(180 70% 70%);
  --color-tier8: hsl(210 70% 70%);
  --color-tier9: hsl(240 70% 70%);
  --color-tier10: hsl(270 70% 70%);
  --color-tier11: hsl(300 70% 70%);
  --color-tier12: hsl(330 70% 70%);
  --font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", sans-serif;
}

body {
  overflow-x: hidden;
  background: #1f1f1f;
  user-select: none;
  font-family: var(--font-family);

  &.grabbing {

    *,
    *::before,
    *::after {
      cursor: grabbing !important;
    }
  }
}

.mask {
  position: fixed;
  inset: 0;
  background: #0009;
  z-index: 100;

  &.hidden {
    display: none;
  }
}

.drag-card-img {
  position: fixed;
  opacity: 0.5;
  pointer-events: none;
  z-index: 20;

  &.hidden {
    display: none;
  }
}

header,
main {
  max-width: 1200px;
  margin: 0 auto;
}

main {
  margin-top: 41px;
  display: flex;
  flex-direction: column;
  padding-bottom: 4px;
}

.btn-container {
  padding: 0 4px;
  margin-top: 12px;

  display: flex;
  align-items: center;
  gap: 2px;

  label {
    display: grid;
    place-items: center;
    border: 1px solid #2a2b2c;
    background: #191a1b;
    color: #8c8c8c;
    padding: 0 6px;
    font-size: 14px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;

    &:has(:disabled) {
      color: #333;
      cursor: auto;
    }

    .file-input {
      display: none;
    }
  }

  @media (hover: hover) {
    label:not(:has(:disabled)):hover {
      filter: brightness(1.1);
    }
  }
}

.tier-list {
  display: grid;
  grid-template-columns: auto 1fr;
  margin: 4px 0 0 4px;
  border: 1px solid #181818;
  width: calc(100% - 36px);

  &:empty {
    display: none;
  }

  .tier-item {
    position: relative;
    grid-column: span 2;
    display: grid;
    grid-template-columns: subgrid;

    .tier-main-container {
      grid-column: span 2;
      display: grid;
      grid-template-columns: subgrid;

      .tier-main-container-inner {
        grid-column: span 2;
        display: grid;
        grid-template-columns: subgrid;

        .tier-label-container {
          display: grid;
          border-right: 1px solid #181818;

          .tier-label {
            display: grid;
            place-items: center;
            text-align: center;
            min-width: 48px;
            padding: 2px 4px;
            color: #2f2f2f;
            font-size: 14px;

            @media (width < 1200px) {
              font-size: max(1.2vw, 0.75rem);
              min-width: max(3.8vw, 32px);
            }
          }
        }
      }
    }

    &.active {
      .tier-main-container-inner {
        z-index: 101;
        pointer-events: none;
        outline: 1px solid #fff;
      }
    }

    &+.tier-item {
      .tier-main-container {
        border-top: 1px solid #181818;
      }
    }

    .tier-menu-btn-container {
      position: absolute;
      right: -32px;
      width: 32px;
      height: 100%;
      display: grid;
      place-items: center;

      .tier-menu-btn {
        all: unset;
        cursor: pointer;
        color: #ccc;
        width: 30px;
        height: 30px;
        border-radius: 50%;
        transition: background-color 0.1s;
      }

      @media (hover: hover) {
        .tier-menu-btn:hover {
          background-color: #fff1;
        }
      }
    }
  }
}

body[data-locked] {
  .tier-list {
    width: calc(100% - 8px);

    .tier-item {
      .tier-menu-btn-container {
        display: none;
      }
    }
  }
}

.card-list {
  display: grid;
  align-content: start;
  background: #1b1b1b;

  &:empty {
    &::before {
      content: '';
      aspect-ratio: 1 / 1;
      pointer-events: none;
    }
  }

  .card-item {
    cursor: grab;
    position: relative;
    aspect-ratio: 1 / 1;

    &.dragging {
      opacity: 0.3;
    }

    .card-img {
      /* position: absolute; */
      /* top: 50%; */
      /* left: 50%; */
      /* transform: translate(-50%, -50%); */
      pointer-events: none;
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
  }
}

body {
  &[data-size-idx="-2"] {
    .card-list {
      grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    }
  }

  &[data-size-idx="-1"] {
    .card-list {
      grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    }
  }

  &[data-size-idx="0"] {
    .card-list {
      grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
  }

  &[data-size-idx="1"] {
    .card-list {
      grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    }
  }

  &[data-size-idx="2"] {
    .card-list {
      grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    }
  }
}

body[data-locked] {
  .card-list {
    .card-item {
      pointer-events: none;
    }
  }
}

.card-list-container {
  display: flex;
  flex-direction: column;
  border: 1px solid #181818;
}

.book-card-list-container {
  margin: 4px 32px 0 4px;
}

body[data-locked] {
  .book-card-list-container {
    margin: 4px 4px 0;
  }
}

.void-card-list-container {
  margin: 4px 32px 0 4px;

  &.hidden {
    display: none;
  }

  .void-card-list {
    .card-item {
      .card-img {
        opacity: 0.3;
      }
    }
  }
}

body[data-locked] {
  .void-card-list-container {
    margin: 4px 4px 0;
  }
}

.void-checkbox-label-container {
  padding: 0 4px;
  margin-top: 4px;
  font-size: 14px;

  .void-checkbox-label {
    display: inline-flex;
    height: 32px;
    height: 32px;
    line-height: 30px;
    border: 1px solid #333;
    border-radius: 4px;
    color: #555;
    cursor: pointer;
    padding: 0 6px;
    gap: 4px;

    &:has(:checked) {
      border-color: #317593;
      color: #ededed;
      background: #1d2c33;
    }

    .void-checkbox {
      display: none;
    }

    .void-checkbox:not(:checked)~.bi:first-of-type {
      display: none;
    }

    .void-checkbox:checked~.bi:last-of-type {
      display: none;
    }
  }
}

@media (width < 720px) {
  body {
    &[data-size-idx="-2"] {
      .card-list {
        grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
      }
    }

    &[data-size-idx="-1"] {
      .card-list {
        grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
      }
    }

    &[data-size-idx="0"] {
      .card-list {
        grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
      }
    }

    &[data-size-idx="1"] {
      .card-list {
        grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
      }
    }

    &[data-size-idx="2"] {
      .card-list {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
      }
    }
  }
}
