:root {
  --red: #ff3034;
  --button-gray: #9b9b9b;
  --text: #050505;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: #ffffff;
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

.page-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-height: 680px;
  overflow: hidden;
  background: #ffffff;
}

.page-shell::after {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  border: 10px solid rgba(255, 48, 52, 0);
  background: rgba(255, 255, 255, 0);
  color: var(--red);
  content: "Drop now";
  font-size: 34px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, border-color 160ms ease, background 160ms ease;
}

.page-shell.dragging::after {
  border-color: rgba(255, 48, 52, 0.88);
  background: rgba(255, 255, 255, 0.72);
  opacity: 1;
}

h1 {
  position: absolute;
  top: 17px;
  left: 50%;
  z-index: 2;
  width: min(1000px, calc(100vw - 40px));
  margin: 0;
  transform: translateX(-50%);
  color: #000000;
  font-size: clamp(44px, 5.25vw, 74px);
  font-weight: 800;
  letter-spacing: 0;
  line-height: 0.98;
  text-align: center;
  white-space: nowrap;
}

.tray {
  position: absolute;
  left: 50%;
  z-index: 1;
  display: block;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.tray-in {
  top: 114px;
  width: clamp(116px, 9.6vw, 154px);
  transform: translateX(-50%);
}

.tray-out {
  top: 550px;
  width: clamp(132px, 10.8vw, 168px);
  transform: translateX(-50%);
}

.drop-button {
  position: absolute;
  top: 350px;
  left: 50%;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(764px, 56vw);
  height: 104px;
  padding: 0 72px;
  transform: translateX(-50%);
  border: 3px solid #8f8f8f;
  border-radius: 19px;
  background: #ffffff;
  color: #101010;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.25;
  overflow: hidden;
  text-align: center;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.drop-button > span:not(.upload-fill) {
  position: relative;
  z-index: 2;
}

.upload-fill {
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 1;
  width: 0%;
  background: #40d66f;
  opacity: 0.82;
  transition: width 180ms ease;
}

.drop-button.ready {
  background: #ffffff;
}

.drop-button.loading {
  color: rgba(16, 16, 16, 0.74);
}

.cleanup-button {
  position: absolute;
  top: 468px;
  left: calc(50% - 200px);
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 400px;
  height: 75px;
  padding: 0 44px;
  transform: none;
  transform-origin: center;
  border: 5px solid #2f80ff;
  border-radius: 999px;
  background: linear-gradient(180deg, #ff2d30 0%, #d52b2b 100%);
  color: #ffffff;
  cursor: default;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  text-align: center;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.32);
  box-shadow: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.cleanup-button.visible {
  cursor: pointer;
  opacity: 1;
  pointer-events: auto;
}

.cleanup-button:hover {
  transform: scale(1.025);
}

.cleanup-button:active {
  transform: scale(0.99);
  box-shadow: none;
}

.loader {
  display: none;
  width: 22px;
  height: 22px;
  margin-left: 16px;
  border: 3px solid rgba(255, 48, 52, 0.24);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

.drop-button.loading .loader {
  display: inline-block;
}

.add-folder {
  position: absolute;
  top: 385px;
  left: calc(50% + min(382px, 28vw) - 54px);
  z-index: 5;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 2px solid rgba(0, 0, 0, 0.22);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: #111111;
  cursor: pointer;
  font-size: 28px;
  font-weight: 300;
  line-height: 1;
}

.add-folder:hover {
  border-color: var(--red);
  color: var(--red);
}

.folder-input {
  display: none;
}

.shelves {
  position: absolute;
  right: 5.6vw;
  bottom: 20px;
  left: 5.6vw;
  display: grid;
  grid-template-columns: repeat(4, 174px);
  justify-content: space-between;
  align-items: end;
  pointer-events: none;
}

.shelves img {
  display: block;
  width: 174px;
  height: 280px;
  object-fit: contain;
  user-select: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 980px) {
  body {
    overflow-y: auto;
  }

  .page-shell {
    min-height: 760px;
  }

  h1 {
    white-space: normal;
  }

  .drop-button {
    width: min(760px, calc(100vw - 42px));
  }

  .cleanup-button {
    top: 468px;
  }

  .add-folder {
    left: calc(100vw - 72px);
  }

  .shelves {
    right: 24px;
    left: 24px;
    grid-template-columns: repeat(4, minmax(88px, 1fr));
    gap: 18px;
  }

  .shelves img {
    width: 100%;
    height: auto;
    max-height: 220px;
  }
}

@media (max-width: 620px) {
  .page-shell {
    min-height: 720px;
  }

  h1 {
    top: 24px;
    font-size: 42px;
  }

  .tray-in {
    top: 148px;
  }

  .drop-button {
    top: 280px;
    height: 96px;
    padding: 0 44px;
    font-size: 17px;
  }

  .add-folder {
    top: 311px;
  }

  .tray-out {
    top: 420px;
  }

  .cleanup-button {
    top: 374px;
    left: 28px;
    width: min(400px, calc(100vw - 56px));
    height: min(75px, calc((100vw - 56px) * 0.1875));
    font-size: 25px;
  }

  .shelves {
    bottom: 18px;
    grid-template-columns: repeat(2, minmax(108px, 150px));
    justify-content: center;
  }

  .shelves img:nth-child(n + 3) {
    display: none;
  }
}
