.tile {
  border-radius: 8px;
  box-sizing: content-box;
  cursor: pointer;
  height: var(--speeddial-tile-height);
  left: 0;
  max-height: var(--speeddial-tile-height);
  pointer-events: all;
  position: absolute;
  top: 0;
  transform: translateZ(0);
  transition: all 0.3s ease;
  width: var(--speeddial-tile-width);
}

.tile .tile-content {
  background-image: -webkit-image-set(url('chrome://theme/IDR_START_PAGE_SPEEDDIAL_PLACEHOLDER') 1x, url('chrome://theme/IDR_START_PAGE_SPEEDDIAL_PLACEHOLDER@2x') 2x);
  background-origin: content-box;
  background-position: 50%;
  background-repeat: no-repeat;
  background-size: cover;
  box-shadow: var(--opera-box-shadow);
}

.tile-main.is-thumbnail .tile-content {
  box-shadow: none;
}

.modal-content-container .add.tile .tile-content {
  box-shadow: none;
}

.add.tile .tile-content,
.folder.tile .tile-content,
.fallback.tile .tile-content {
  background-image: none;
}

:host-context(html.gx) .tile {
  --radius: 4px;
  border-radius: var(--radius);
  box-shadow: none;
}

:host-context(html.gx) .tile-content {
  --border: 0;
  --cut: 16px;
  --width: var(--speeddial-tile-width);
  --height: var(--speeddial-tile-height);
  background-size: cover;
  clip-path: polygon(
               var(--cut) 0,
               var(--width) 0,
               var(--width) calc(var(--height) - var(--cut)),
               var(--width) calc(var(--height) - var(--cut)),
               calc(var(--width) - var(--cut)) var(--height),
               0 var(--height),
               0 var(--cut)
             );
}

.folder .add.tile {
  box-shadow: none;
}

:host-context(html.no-animations) .tile {
  transition: all 0s;
}

.tile .title-container {
  border-radius: inherit;
  cursor: pointer;
  height: 32px;
  position: absolute;
  top: var(--speeddial-tile-height);
  width: 100%;
}

.speeddial .add.tile .title-container {
  align-items: center;
  display: flex;
  height: var(--speeddial-tile-height);
  justify-content: center;
  top: 0;
}

.speeddial .sole.add.tile .title-container {
  height: 32px;
}

.title .title-container:before {
  border-radius: inherit;
  bottom: 0;
  content: '';
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  transition: background-color 0.3s;
}

.tile .title {
  background-color: transparent;
  box-sizing: border-box;
  color: var(--opera-font-color);
  text-shadow: 0px 1px 2px var(--opera-shadow-color);
  display: block;
  height: 100%;
  line-height: 16px;
  overflow: hidden;
  padding: 8px;
  text-align: center;
  text-overflow: ellipsis;
  transition: color 0.3s;
  white-space: nowrap;
}

:host-context(.modals-container) .tile .title {
  color: var(--opera-font-color);
  text-shadow: none;
}

:host-context(.modals-container) .add.tile::before {
  background-color: var(--opera-font-color);
}

:host-context(.modals-container) .add.tile .tile-content {
  box-shadow: none;
}

.modal-content-container .tile .title {
  text-shadow: none;
}

.add.tile .title {
  text-shadow: none;
}

.tile .context-menu-button {
  background-image: url(/Content/images/tool/context_menu_button.svg);
  background-position: 50% 50%;
  background-repeat: no-repeat;
  background-size: 11px;
  border-radius: 50%;
  height: 21px;
  opacity: 0;
  position: absolute;
  right: 4px;
  top: 4px;
  width: 21px;
}

.tile:hover .context-menu-button {
  background-color: rgba(0, 0, 0, 0.2);
  opacity: 1;
}

.tile:hover .context-menu-button:hover,
.context-menu-opened .context-menu-button {
  background-color: rgba(0, 0, 0, 0.3);
  opacity: 1;
}

:host-context(html.gx) .tile .context-menu-button {
  background: none;
  background-color: white;
  -webkit-mask-image: url(chrome://op-resources/images/gx/ellipsis.svg);
  -webkit-mask-position: 50% 50%;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: 12px;
}

.tile.add {
  background: none;
}

.tile.add::before {
  background-color: var(--opera-font-color);
  content: '';
  height: 100%;
  left: 0;
  -webkit-mask-image: url('chrome://op-resources/images/speed-dial-plus-icon.svg');
  -webkit-mask-position: 50% 50%;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: 50px 50px;
  opacity: 0.7;
  position: absolute;
  top: 0;
  transition: background-color 0.3s;
  width: 100%;
}

.folder .tile.add::before {
  background-color: var(--opera-font-color);
}

/* New design when the plus tile is the only one in the row */

.speeddial .add.tile {
  height: var(--speeddial-tile-height);
  transition: top 0.3s, left 0.3s, transform 0.3s, background 0s, opacity 0s;
}

:host-context(html.gx) .speeddial .folder.tile .tile-content,
.speeddial .add.tile .tile-content {
  background-color: rgba(0, 0, 0, 0.5);
}

:host-context(html.no-animations) .speeddial .add.tile {
  transition: all 0s;
}

.speeddial .add.tile .title {
  color: white;
  display: -webkit-box;
  height: auto;
  line-height: 18px;
  max-height: 46px;
  overflow: hidden;
  white-space: initial;
  width: calc(var(--speeddial-tile-width) - 16px);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.speeddial .sole.add.tile .title {
  display: block;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: var(--speeddial-tile-width);
}

:host-context(html.no-wallpaper) .speeddial .add.tile .tile-content {
  background-color: var(--opera-tile-background-color);
}

:host-context(html.no-wallpaper) .speeddial .add.tile .title {
  color: black;
}

:host-context(html.no-wallpaper.dark-theme) .speeddial .add.tile .title {
  color: white;
}

.speeddial .add.tile .title::before {
  content: '+';
  padding-right: 5px;
}

.speeddial .add.tile::before {
  -webkit-mask-image: none;
  background-color: inherit;
  border-radius: inherit;
}

.speeddial .sole.add.tile {
  height: 32px;
}

.speeddial .sole.add.tile .title {
  height: 32px;
  padding-top: 8px;
}

.tile-main {
  display: inline-block;
  border-radius: inherit;
  height: 100%;
  position: relative;
  width: 100%;
}

.tile-content {
  background-size: cover;
  background-repeat: no-repeat;
  border-color: transparent;
  border-radius: inherit;
  height: 100%;
  width: 100%;
}

.tile .fallback-content {
  border-radius: inherit;
  font-size: var(--speeddial-tile-width);
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  position: relative;
  vertical-align: middle;
  width: 100%;
}

.tile .fallback-content > div {
  color: rgba(255, 255, 255, 1);
  margin-top: -1em;
  position: absolute;
  white-space: nowrap;
}

.tile .fallback-content > div:after {
  content: attr(data-content);
}

.folder.tile {
  line-height: normal;
  text-align: left;
}

.folder.tile .tile-content {
  background-color: var(--opera-folder-background-color);
  background-image: none;
}

.tile.folder .tile.fallback .fallback-content {
  font-size: 56px;
}

:host-context(html.bigger-tiles) .tile.folder .tile.fallback .fallback-content {
  font-size: 82.72px;
}

:host-context(html:not(.gx)) .tile.is-current-target {
  border-radius: 0;
}

:host-context(html:not(.gx)) .tile:not(.folder).is-current-target .tile-content {
  background-color: rgba(0, 0, 0, 0.4);
  background-image: none;
  border: 10px solid rgba(255, 255, 255, 0.25);
  border-radius: 7px;
  margin: -10px;
  transition: border .3s ease-out, margin .3s ease-out;
}

:host-context(html.no-wallpaper:not(.dark-theme)) .tile:not(.folder).is-current-target .tile-content {
  border: 10px solid rgba(0, 0, 0, 0.25);
}

.tile:not(.folder).is-current-target .tile-content > * {
  border-radius: 0;
}

:host-context(html:not(.gx)) .tile:not(.folder).is-current-target .title-container {
  height: var(--speeddial-tile-height);
  transition: border .2s ease-out, margin .2s ease-out;
  width: var(--speeddial-tile-width);
}

:host-context(html:not(.gx)) .folder.tile.is-current-target {
  border-radius: 8px;
  opacity: 1;
}

:host-context(html.no-wallpaper:not(.dark-theme)) .folder.tile.is-current-target {
  background-color: rgba(128, 128, 128, 0.3);
}

.tile.context-menu-opened {
  pointer-events: none;
}

.tile.context-menu-opened .context-menu-button {
  background-color: hsla(0, 0%, 0%, 0.4);
  opacity: 1;
}

.tile.dragged {
  pointer-events: none;
  transition: 0s;
  z-index: 1;
}

.tile.invisible {
  opacity: 0 !important;
  transition: 0s;
}

.dragging .tile {
  cursor: default;
}

.dragging .tile > * {
  pointer-events: none;
}

.tile.keyboard-mode:focus:after {
  border-radius: 8px;
  bottom: 0;
  box-shadow: 0 0 0 2px hsl(204, 100%, 45%) inset,
    0 0 0 3px hsl(0, 100%, 100%) inset, rgba(0, 0, 0, 0.23) 0 10px 20px -8px !important;
  content: '';
  display: block;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  transform: scale(1.012);
}

.dragged.tile .title,
.is-current-target.tile .title {
  opacity: 0;
}

.dragged.tile {
  opacity: 0.7;
}

.tile .favicon {
  background-size: 16px;
  height: 16px;
  left: 6px;
  pointer-events: none;
  position: absolute;
  top: 6px;
  width: 16px;
}

.tile .search-container {
  align-items: center;
  justify-content: center;
  bottom: 0;
  display: flex;
  height: 50%;
  position: absolute;
  width: 100%;
}

.tile .search-box {
  box-sizing: border-box;
  display: flex;
  position: relative;
}

.tile .search-box input[type=text] {
  background-color: white;
  border: 0;
  border-radius: 4px;
  font-size: 11px;
  height: 25px;
  max-width: 98px;
  padding: 2px 22px 2px 8px;
}

:host-context(html.bigger-tiles) .tile .search-box input[type=text] {
  font-size: 13px;
  height: 29px;
  max-width: 120px;
}

.tile .is-thumbnail .search-box {
  transform: scale(0.36);
}

:host-context(html.bigger-tiles) .tile .is-thumbnail .search-box {
  transform: scale(0.44);
}

.tile .search-box input[type=text]::placeholder {
  color: #444;
}

.tile .search-box .loupe {
  background: url(chrome://op-resources/images/aliexpress/loupe.png);
  background-position: right;
  background-repeat: no-repeat;
  background-size: 18px;
  cursor: pointer;
  height: 18px;
  width: 18px;
  position: absolute;
  right: 4px;
  top: 6px;
}

:host-context(html.bigger-tiles) .tile .search-box .loupe {
  top: 8px;
  right: 6px;
}
