*,
*:before,
*:after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;

  -webkit-user-select: none; /* Для Webkit-браузеров (Chrome, Safari) */
  -moz-user-select: none;    /* Для Firefox */
  -ms-user-select: none;     /* Для Internet Explorer/Edge */
  user-select: none;         /* Стандартное свойство */
  -webkit-touch-callout: none; /* Отключает всплывающее меню при долгом нажатии на iOS и некоторых Android */

  -webkit-tap-highlight-color: transparent; /* for chrome blue selection overlay */
}

ul, ol {
  list-style: none;
}

html {
  --font-sans-serif: -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Ubuntu, roboto, noto, arial, sans-serif;
  --font-serif: Iowan Old Style, Apple Garamond, Baskerville, Times New Roman, Droid Serif, Times, Source Serif Pro, serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol;

  font-family: var(--font-sans-serif);

  --save: hsl(140deg 70% 55%);
  --delete: hsl(355deg 74% 58%);
}

html, body {
  height: 100%;
}

.wrapper {
  height: 100dvh;
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  font-size: 1.5rem;
  background-color: #333;
  background-image: repeating-linear-gradient(-45deg, hsl(0deg 0% 0% / 0.02), hsl(0deg 0% 0% / 0.02) 5px, transparent 5px, transparent 10px);
}

#options, #vault {
  color: #ccc;
  padding: 2rem 1rem;
  overflow: auto;
  
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  -webkit-user-select: auto;
  -moz-user-select: auto;
  -ms-user-select: auto;
  user-select: auto;
}
#vault {
  padding: 2rem 1rem 2rem 2rem;
  justify-content: flex-start;
}
#options ul {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}
#vault ul {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: flex-start;
}

#vault li {
  cursor: pointer;
  transition: transform 0.3s ease;
  user-select: none;
  position: relative;
}
#vault li::before {
  content: '';
  display: inline-block;
  width: 1rem;
  height: 1rem;
  mask: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="black" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon></svg>') center / contain no-repeat;
  background-color: hsl(0deg 0 0 / 0.15);
  margin-right: 0.5rem;
  vertical-align: middle;
  cursor: pointer;
}
#vault li.liked::before {
  mask: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="black" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon></svg>') center / contain no-repeat;
  background-color: currentColor;
}
#vault li.deleting::after {
  position: absolute;
  top: 0;
  right: 0;
  transform: translateX(calc(100% + 0.5rem));
  content: 'delete';
  background-color: var(--delete);
  color: #fff;
  font-size: 0.75rem;
  height: 100%;
  padding: 0 0.5rem;
  border-radius: 0.25rem;
  display: flex;
  justify-content: center;
  align-items: center;
  /* animation: popup 0.1s ease forwards; */
  opacity: 1;
}

@keyframes popup {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

#options li {
  cursor: pointer;
/*   box-shadow: 0 0 0 3px hsl(0deg 0 0 / 0.2); */
  background-color: hsl(0deg 0 0 / 0.15);
  height: 3.5rem;
  width: 3.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 33%;
}
#options li.selected {
  background-color: #ccc;
  color: #222;
  font-weight: bold;
}

#app {
  border-radius: 1rem;
  margin: 2rem 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto max-content auto;
}

#result {
  background-color: #FAF8F0;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 5rem;
  color: #333;
}

#field {
  max-width: 75%;
  overflow: auto;
  background-color: hsl(48deg 30% 91%);
  font-size: clamp(1rem, 15vw - 2rem, 2rem);
  font-weight: bold;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  cursor: grab;
  user-select: none;
  z-index: 2;
  transition: scale 0.2s ease, transform 0.2s ease;
  animation: show 0.2s ease forwards;
}

@keyframes show {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.3);
  }
  100% {
    transform: scale(1);
  }
}

#field.hold {
  cursor: grabbing;
  position: absolute;
  scale: 1.1;
}

#openOptions, #openVault {
  display: none;
  /* transition: all 0.5s ease; */
}

#favorite, #trash {
  padding: 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
}
#favorite {
  background-color: var(--save);
  cursor: pointer;
}
#trash {
  background-color: var(--delete);
  cursor: pointer;
}
#favorite svg, #trash svg {
  opacity: 0.2;
}
#favorite.action svg {
  animation: show 0.2s ease forwards;
}
#trash.action svg {
  animation: show 0.2s ease forwards;
}

.draggable {
  touch-action: none; /* 🔥 Это ОЧЕНЬ важно для работы preventDefault */
}


@media (max-width: 800px) {
  body {
    overflow: hidden;
    max-width: 100vw;
    position: relative;
  }

  .wrapper {
    overflow: hidden;
    max-width: 100vw;
    position: relative;
    
    display: flex;
  }
  
  #options {
    position: absolute;
    min-height: 100dvh;
    inset: 0 20vw 0 0;
    transition: transform 0.5s ease;
  }

  #vault {
    position: absolute;
    min-height: 100dvh;
    inset: 0 0 0 20vw;
    transition: transform 0.5s ease;
  }
  
  #app {
    position: absolute;
    inset: 0;
    margin: 0;
    border-radius: 0;
    min-height: 100dvh;
    z-index: 2;
    /* transition: transform 1s ease, border-radius 0.5s ease; */
  }
  #openOptions, #openVault {
    flex-shrink: 0;
/*     background-color: #ebebeb; */
    cursor: pointer;
    width: 64px;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0.95;
  }
  #openOptions {
    margin-right: auto;
  }
  #openVault {
    margin-left: auto;
  }
  #openOptions svg, #openVault svg {
    flex-shrink: 0;
  }
  
  /*
  #app.optionsActive, #vault.optionsActive {
    transform: translateX(80%);
    border-radius: 1rem;
  }
  
  #app.vaultActive, #options.vaultActive {
    transform: translateX(-80%);
    border-radius: 1rem;
  }
  */

  #app.active {
    border-radius: 1rem;
  }
  #openVault.active, #openOptions.active {
    width: 20vw;
    height: 100dvh;
    /* background-color: grey; */
  }
}